-
Notifications
You must be signed in to change notification settings - Fork 2
/
request.php
48 lines (35 loc) · 1.52 KB
/
request.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
42
43
44
45
46
47
48
<?php
$conn = mysqli_connect("localhost", "root", "", "request");
// Check connection
if($conn === false){
die("ERROR: Could not connect. "
. mysqli_connect_error());
}
// Taking all values from the form data(input)
$fname = $_POST['fname'];
$iname = $_POST['iname'];
$NIC = $_POST['NIC'];
$email = $_POST['email'];
$address = $_POST['address'];
$city = $_POST['city'];
$pcode = $_POST['pcode'];
$ipolicy = $_POST['ipolicy'];
$itype = $_POST['itype'];
$vnum = $_POST['vnum'];
$cnum = $_POST['cnum'];
$enum = $_POST['enum'];
$crnum = $_POST['crnum'];
// Performing insert query execution
$sql = "INSERT INTO requestInsurance VALUES ('$fname',
'$iname','$NIC','$email','$address','$city','$pcode','$ipolicy','$itype','$vnum','$cnum','$enum','$crnum')";
if(mysqli_query($conn, $sql)){
echo "data stored in a database successfully.";
header("Location: " . "http://localhost/IWT%20final%20project/request.php");
} else{
echo "ERROR:Try again $sql. "
. mysqli_error($conn);
header("Location: " . "http://localhost/IWT%20final%20project/request.php");
}
// Close connection
mysqli_close($conn);
?>