-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflood_insurance.php
41 lines (34 loc) · 1.21 KB
/
flood_insurance.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
// Define database connection variables
$host = "localhost";
$username = "root";
$password = "";
$dbname = "test";
// Create database connection
$conn = mysqli_connect($host, $username, $password, $dbname);
// Check database connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST["name"];
$email = $_POST["email"];
$phone = $_POST["phone"];
$dob = $_POST["dob"];
$gender = $_POST["gender"];
$coverage = $_POST["coverage"];
$term = $_POST["term"];
$smoker = $_POST["smoker"];
$conditions = $_POST["conditions"];
$condition_description = $_POST["condition_description"];
$sql = "INSERT INTO flood_insurance (name, email, phone, dob, gender, coverage, term, smoker, conditions, condition_description)
VALUES ('$name', '$email', '$phone', '$dob', '$gender', '$coverage', '$term', '$smoker', '$conditions', '$condition_description')";
if (mysqli_query($conn, $sql)) {
echo " <h2>Data inserted successfully.<h2>";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
// Close database connection
mysqli_close($conn);
}
?>