-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbookdb.php
37 lines (28 loc) · 1.2 KB
/
bookdb.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
<?php
include('./db.php');
// Get the form data
$bookingdate = $_POST['bookingdate'];
$daytype = $_POST['daytype'];
$session = $_POST['session'];
$email = $_POST['email'];
$seats = $_POST['seatsid'];
$price = $_POST['totalPrice'];
$count = $_POST['count'];
$name = $_POST['name'];
$mobile = $_POST['number'];
$coupon = $_POST['cpnSelect'];
$discount = $_POST['discount'];
$netTotal = $_POST['netTotal'];
// $dt = $bookingdate->format('Y-m-d H:i:s');
// $date = substr($dt,0,10);
// Insert the data into the bookings table
$sql = "INSERT INTO `booked` (`booking_id` , `date` , `email` , `session` , `name`, `mobile`, `count` , `price` ,`seats_id`,`coupon_code`,`discount_amount`,`total`) VALUES (NULL,'$bookingdate', '$email', '$session','$name','$mobile', '$count','$price','$seats','$coupon','$discount','$netTotal')";
if (mysqli_query($conn, $sql)) {
echo "<script>
alert('Booking created successfully !!');
window.location.href='./index.php';
</script>";
exit();
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}