D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home3
/
encodto1
/
salon.encodersunlimited.com
/
Filename :
booking.php
back
Copy
<?php // Add this before <html> OR in the head section include 'sissadminor/config.php'; // Fetch categories $categories = []; $result = mysqli_query($conn, "SELECT * FROM service_category"); if ($result) { while ($row = mysqli_fetch_assoc($result)) { $categories[] = $row; } } if ($_SERVER['REQUEST_METHOD'] === 'POST') { $f_name = mysqli_real_escape_string($conn, $_POST['firstname']); $l_name = mysqli_real_escape_string($conn, $_POST['lastname']); $email = mysqli_real_escape_string($conn, $_POST['email']); $number = mysqli_real_escape_string($conn, $_POST['phone']); $gender = mysqli_real_escape_string($conn, $_POST['staff']); $service = mysqli_real_escape_string($conn, $_POST['service']); $appointment_date = mysqli_real_escape_string($conn, $_POST['date']); // Convert to proper datetime format if needed $appointment_date = date('Y-m-d H:i:s', strtotime($appointment_date)); $sql = "INSERT INTO booking (f_name, l_name, email, number, gender, service, appointment_date) VALUES ('$f_name', '$l_name', '$email', '$number', '$gender', '$service', '$appointment_date')"; if (mysqli_query($conn, $sql)) { echo "<script>alert('Appointment booked successfully!');</script>"; } else { echo "<script>alert('Error: " . mysqli_error($conn) . "');</script>"; } } ?> <!doctype html> <html lang="en"> <head> <?php include "style.php"; ?> </head> <body> <!-- PRELOADER SPINNER ============================================= --> <div id="loading" class="loading-black"> <div id="loading-center"><span class="loader"></span></div> </div> <!-- STYLE SWITCHER ============================================= --> <div id="stlChanger"> <div class="blockChanger bgChanger"> <a href="#" class="chBut ico-35"> <p class="switch"> <span class="drk-mode flaticon-moon"></span> <span class="lgt-mode flaticon-sum"></span> </p> </a> </div> </div> <!-- END SWITCHER --> <!-- PAGE CONTENT ============================================= --> <div id="page" class="page"> <!-- HEADER ============================================= --> <?php require 'header.php' ?> <!-- END HEADER --> <!-- INNER PAGE HERO ============================================= --> <section id="booking-page" class="inner-page-hero division"> <div class="container"> <div class="row"> <div class="col"> <div class="page-hero-txt color--white"> <h2>Book an Appointment</h2> <p>Please fill out the appointment form below to make appointment</p> </div> </div> </div> </div> <!-- End container --> </section> <!-- END INNER PAGE HERO --> <!-- BOOKING-1 ============================================= --> <div id="booking-1" class="pt-8 pb-7 booking-section division"> <div class="container"> <!-- BOOKING FORM --> <div class="row justify-content-center"> <div class="col-lg-10 col-xl-9"> <form name="bookinkform" action="" method="POST" class="row booking-form"> <!-- Form Input --> <div class="col-lg-6"> <input type="text" name="firstname" class="form-control firstname" placeholder="First Name*" required> </div> <!-- Form Input --> <div class="col-lg-6"> <input type="text" name="lastname" class="form-control lastname" placeholder="Last Name*" required> </div> <!-- Form Input --> <div class="col-lg-6"> <input type="email" name="email" class="form-control email" placeholder="Email Address*" required> </div> <!-- Form Input --> <div class="col-lg-6"> <input type="tel" name="phone" class="form-control phone" placeholder="Phone Number*" required> </div> <!-- Form Select --> <!-- Form Select --> <div class="col-lg-6"> <select name="staff" class="form-select staff" aria-label="Staff Select"> <option selected>Select Gender</option> <option>Male</option> <option>Female</option> </select> </div> <div class="col-lg-6"> <select name="service" class="form-select service" aria-label="Service Select" required> <option value="" selected disabled>Select Service</option> <?php foreach ($categories as $category): ?> <option value="<?= htmlspecialchars($category['id']) ?>"> <?= htmlspecialchars($category['name']) ?> </option> <?php endforeach; ?> </select> </div> <!-- Form Input --> <div class="col-md-12"> <input id="datetimepicker" type="text" name="date" class="form-control date" placeholder="Appointment Date*" required> </div> <!-- Form Button --> <div class="col-md-12 text-center"> <button type="submit" class="btn btn--tra-black hover--black submit">Book Appointment</button> </div> <!-- Form Message --> <div class="col-md-12 booking-form-msg"> <div class="sending-msg"><span class="loading"></span></div> </div> </form> </div> </div> <!-- END BOOKING FORM --> </div> <!-- End container --> </div> <!-- END BOOKING-1 --> </div> <!-- END PAGE CONTENT --> <!-- EXTERNAL SCRIPTS ============================================= --> <?php include 'footer.php' ?> </body> </html>