<?php
include 'db_connection.php'; // وارد کردن اطلاعات اتصال به دیتابیس

// بررسی اتصال
if ($conn->connect_error) {
    die("اتصال ناموفق: " . $conn->connect_error);
}

if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $first_name = $_POST['first_name'];
    $last_name = $_POST['last_name'];
    $national_id = $_POST['national_id'];
    $phone_number = $_POST['phone_number'];

    $sql = "INSERT INTO arazi_file (first_name, last_name, national_id, phone_number)
    VALUES ('$first_name', '$last_name', '$national_id', '$phone_number')";

    if ($conn->query($sql) === TRUE) {
        echo "اطلاعات با موفقیت ذخیره شد.";
    } else {
        echo "خطا: " . $conn->error;
    }

    $conn->close();
}
?>
