if (isset($_POST['setMenu'])) { $setMenu = $_POST['setMenu']; } $food = '0'; if (!empty($_POST['food'])) { $food = implode('|', $_POST['food']); } $amount = $_POST['amount']; $full = $_POST['foodFull']; $fullamount = ''; $j = 0; for ($i = 0; $i < count($full); $i++) { for ($j; $j < $i + 1; $j++) { $fullamount .= $full[$i] . '|' . $amount[$j] . ';'; } } $fullamount = rtrim($fullamount, ';'); $totalCost = getTotalBookingAmount($service, $guest, $gate, $stage, $food, $full, $amount, $setMenu); if (!similarDateShift($date, $shift)) { setOrder($user, $date, $shift, $purpose, $service, $guest, $gate, $stage, $food, $totalCost, $fullamount, $setMenu, date("Y-m-d")); echo '<script language="javascript"> alert("Temporarily Booked !!\\nYour Total Cost is ' . $totalCost . '.00"); window.location="' . SERVER . '/myBookings"; </script>'; } else { echo '<script language="javascript"> alert("Date and shift have already chosen !!"); window.location="' . SERVER . '/booking"; </script>'; } }
<?php require '../model/db.php'; $value = $_GET['query']; $dob = $_GET['date']; $date = str_replace('/', '-', $dob); $date = date('Y-m-d', strtotime($date)); if (similarDateShift($date, $value)) { echo "**{$value} has already booked !! Please select another shift."; }