This repository has been archived by the owner on Mar 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsave_checkout_reserve.php
43 lines (29 loc) · 1.75 KB
/
save_checkout_reserve.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
<?php
session_start();
include("conf/connection.php");
include("conf/function.php");
//$totalprice = $_POST['totalprice'];
$reserv_date_reservation = dt_tochristyear($_POST['reserv_date_reservation']);
$reserv_date_appointment = date("Y-m-d", strtotime(tochristyear($_POST['reserv_date_appointment'])));
$sqlreservations = "INSERT INTO reservations SET
reserv_date_appointment = '" . $reserv_date_appointment . "',
reserv_time_appointment = '" . $_POST['reserv_time_appointment'] . "',
reserv_date_reservation = '" . $reserv_date_reservation . "',
reserv_status = '0',
reserv_note = '". $_POST['reserve_note'] ."',
cusid = '" . $_SESSION['user_id'] . "'";
mysqli_query($link, $sqlreservations) or die(mysqli_error($link));
$last_reserveid = mysqli_insert_id($link);
for ($i = 0; $i < count($_SESSION['food']['reserve']['tables_no']); $i++) {
$sqlreservlist = "INSERT INTO reservelist SET
reservlist_amount = '" . $_SESSION['food']['reserve']['seats'][$i] . "',
reservlist_status = '0',
reservlist_note = '" . $_POST['reservlist_note_' . $i] . "',
reserv_id = '" . $last_reserveid . "',
tables_no = '" . $_SESSION['food']['reserve']['tables_no'][$i] . "'";
mysqli_query($link, $sqlreservlist) or die(mysqli_error($link));
}
unset($_SESSION['food']['reserve']);
echo '<script>alert("บันทึกการจองเรียบร้อยแล้ว\nรหัสการจองคือ ' . str_pad($last_reserveid,5,0,STR_PAD_LEFT) . '"); window.location.assign("reserve_history.php")</script>';
mysqli_close($link);
?>