/
var
/
www
/
barefootlaw.org
/
will-generator
/
Upload File
HOME
<?php // Start the session session_start(); // Check if the form is submitted if ($_SERVER["REQUEST_METHOD"] == "POST") { // Database connection parameters $servername = "localhost"; $username = "will_generator"; $password = "Gtscq_!hQnBDRC_u"; $dbname = "will_generator"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // Retrieve form data // Retrieve user's ID from the session $fname = $_POST['fname']; $lname = $_POST['lname']; $othername = $_POST['othername']; $age = $_POST['age']; $dob = $_POST['dob']; $marital_status = $_POST['marital_status']; $spouse_name = $_POST['spouse_name']; $spouse_age = $_POST['spouse_age']; $gender = $_POST['gender']; $email = $_POST['email']; $contact = $_POST['contact']; $subcounty = $_POST['subcounty']; $district = $_POST['district']; // Insert data into the database with user's ID $sql = "INSERT INTO will_info (fname, lname, othername, age, dob, marital_status, spouse_name, spouse_age, gender, email, contact,subcounty,district) VALUES ('$fname', '$lname', '$othername', '$age', '$dob', '$marital_status', '$spouse_name', '$spouse_age', '$gender', '$email', '$contact','$subcounty','$district')"; if ($conn->query($sql) === TRUE) { // Redirect to the next page (willform2.php) $_SESSION['session_id'] = $conn->insert_id; header("Location: willform2.php"); exit(); } else { // Handle the error if the query fails echo "Error: " . $sql . "<br>" . $conn->error; } // Close the database connection $conn->close(); } ?>