-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbook_form.php
26 lines (23 loc) · 964 Bytes
/
book_form.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
<?php
$connection = mysqli_connect('localhost', 'root', '', 'travel_db');
if (isset($_POST['send'])) {
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$address = $_POST['address'];
$location = $_POST['location'];
$guests = $_POST['guests'];
$arrivals = $_POST['arrivals'];
$leaving = $_POST['leaving'];
$request = "INSERT INTO book_form (name, email, phone, address, location, guests, arrivals, leaving) VALUES ('$name', '$email', '$phone', '$address', '$location', '$guests', '$arrivals', '$leaving')";
if (mysqli_query($connection, $request)) {
// Store the last inserted ID in the session
session_start();
$_SESSION['order_id'] = mysqli_insert_id($connection);
header('location: view_order.php'); // Redirect to the view order page
exit();
} else {
echo 'Something went wrong, please try again';
}
}
?>