-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbookingSubmit.php
36 lines (32 loc) · 1.11 KB
/
bookingSubmit.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
<?php
$firstname = filter_input(INPUT_POST, 'firstname');
$lastname = filter_input(INPUT_POST, 'lastname');
$phone = filter_input(INPUT_POST, 'phone');
$people = filter_input(INPUT_POST, 'people');
$time = filter_input(INPUT_POST, 'time');
$host = "localhost";
$dbusername = "zumanex_admin";
$dbpassword = "vbtYN566nrF";
$dbname = "zumanex_reservations";
//Create connection
$conn = new mysqli ($host, $dbusername, $dbpassword, $dbname);
if (mysqli_connect_error()){
die ('Connect Error ('.mysqli_connect_errno() .') '
. mysqli_connect_error());
}
else {
$sql = "INSERT INTO bookings (firstname, lastname, phone, people, time)
values ('$firstname', '$lastname', '$phone', '$people', '$time')";
if ($conn->query($sql)){
echo "Hi $firstname, your booking for a table of <b>$people</b> person(s) at <b>$time</b> has been submitted successfully.";
echo "<br>";
echo "<br>";
echo "You may now close this tab or go back to another page on our website.";
}
else{
echo "Error: ". $sql . "<br>" . $conn->error;
}
$conn->close();
}
?>
<?php include 'navigation.php'?>