<!doctype html> <html> <title> View Bookings </title> <head> <h1> Bookings made</h1> </head> <body> <?php include_once "bookingServer.php"; echo "<table border=1> <tr><td>Booking Id </td> <td> <b> Room Number <b> </td> <td> Booked Time </td> <td>\nBooked Date</td> <td> Booker Name </td> <td> Booker Phone Number</td> <td> Booker Email</td> <td> Booking Title </td> </tr>"; $booking = new bookings(); echo $booking->get_all_bookings(); while ($row = $booking->fetch()) { echo "<tr> "; echo "<td> {$row['book_id']} </td> <td> {$row['room_number']}</td> <td> {$row['booked_time']} </td> <td> {$row['booked_date']} </td> <td> {$row['booker_name']} </td> <td> {$row['booker_phone']} </td> <td> {$row['booker_email']} </td> <td> {$row['booking_title']} </td>"; echo "</tr>"; } echo "</table>"; ?> </body> </html>
</div> </div> <?php include_once "bookingServer.php"; $room = NULL; $sqltime = NULL; $sqldate = NULL; $name = NULL; $phone = NULL; $email = NULL; $title = NULL; $book = new bookings(); if (isset($_REQUEST['room'])) { $room = $_REQUEST['room']; echo $room; } if (isset($_REQUEST['date'])) { $userdate = $_REQUEST['date']; //$datestamp = DateTime::createFromFormat('d/m/Y', $userdate); $sqldate = date('Y-m-d', strtotime($userdate)); //$sqldate=$datestamp->format('Y-m-d'); } if (isset($_REQUEST['time'])) { $sqltime = $book->convert_time($_REQUEST['time']); } if (isset($_REQUEST['name'])) { $name = $_REQUEST['name'];
echo "<tr {$style}>"; echo "<td> {$row['book_id']} </td> <td> {$row['room_number']}</td> \n\t\t\t\t\t\t\t\t<td> {$row['start_time']} - {$row['end_time']} </td> <td> {$row['booked_date']} </td> \n\t\t\t\t\t\t\t\t<td> {$row['booker_name']} </td> <td> {$row['booker_phone']} </td>\n\t\t\t\t\t\t\t\t <td> {$row['booker_email']} </td> <td> {$row['booking_title']} </td>"; echo "</tr>"; } ?> </table> </div> </div> <?php include_once "bookingServer.php"; $book = new bookings(); if (!empty($_REQUEST['room']) && !empty($_REQUEST['datepicker']) && !empty($_REQUEST['start_time']) && !empty($_REQUEST['end_time']) && !empty($_REQUEST['booker_name']) && !empty($_REQUEST['booker_phone']) && !empty($_REQUEST['booker_email']) && !empty($_REQUEST['booking_title'])) { $room = $_REQUEST['room']; $title = $_REQUEST['booking_title']; $userdate = $_REQUEST['datepicker']; //$datestamp = DateTime::createFromFormat('d/m/Y', $userdate); $sqldate = date('Y-m-d', strtotime($userdate)); //$sqldate=$datestamp->format('Y-m-d'); $email = $_REQUEST['booker_email']; $phone = $_REQUEST['booker_phone']; $name = $_REQUEST['booker_name']; $start_time = $book->convert_time($_REQUEST['start_time']); $end_time = $book->convert_time($_REQUEST['end_time']); $book->create_booking($room, $start_time, $end_time, $sqldate, $name, $phone, $email, $title); } ?>