MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 3.21.46.24
Web Server : Apache
System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : ppcad7no ( 715)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0750) :  /home2/ppcad7no/relianttourism.com/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/relianttourism.com/booking.php
<?php
    include_once('admin/config.php');
    if ($_SERVER["REQUEST_METHOD"] === "POST") {
        if (isset($_POST['submit-booking'])) {
            $tour_name=$_POST['tour_name'];
            $price=$_POST['price'];
            $car_type=$_POST['car_type'];
        }
        
        if (isset($_POST['booking'])) {
            $tour_name=$_POST['tour_name'];
            $name=$_POST['name'];
            $phone=$_POST['phone'];
            $email=$_POST['email'];
            $date=$_POST['date'];
            $car_type=$_POST['car_type'];
            $price=$_POST['price'];
            $date=$_POST['date'];
            date_default_timezone_set('Asia/Kolkata');
            $currentDate = date('Y-m-d');
            $sqli="INSERT INTO `tbl_order`(
                `ord_amount`,
                `ord_ord_name`,
                `ord_pack_type`,
                `ord_person_name`,
                `ord_email`,
                `ord_mobile`,
                `ord_doj`,
                `ord_status`,
                `ord_date`) 
                VALUES (
                '$price',
                '$tour_name', 
                '$car_type', 
                '$name',
                '$email',
                '$phone',
                '$date',
                'Not Paid',
                '$currentDate')";
            $result = mysqli_query($db, $sqli) or die("Query unsuccessful t");
// window.alert('Succesfully Submitted, Please Pay Now!');
	        if($result){
                    echo ("<script>
                     window.alert('Succesfully submitted your query, We will contact you soon!');
                     window.location.href='index.html';
                    </script>");
	        	
	        	mysqli_close($db);
             }else{
                echo"Error ";
            }
        }
    }
?>
<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Booking  | Bhatia Taxi Service</title>

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

    <?php include "links.php";?>
    <style>
        .booking-container .container {
            max-width: 800px;
            margin: 20px auto;
            padding: 20px;
            background-color: #fff;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            border-radius: 5px;
        }

        #bookingForm  h1 {
            text-align: center;
            margin-bottom: 20px;
            color: var(--primary-color);
        }

     
        #bookingForm form {
            margin: 20px;
            display:flex;
            width: 100%;
        }

        #bookingForm label {
            display: block;
            margin-bottom: 5px;
            font-weight: bold;
        }

        input[type="text"],
        input[type="date"],
        input[type="email"],
        select {
            width: 100%;
            padding: 10px;
            margin-bottom: 10px;
            border: 1px solid #ccc;
            border-radius: 4px;
        }

        #bookingForm button {
            width: 100%;
            padding: 10px;
            background-color: var(--primary-color);
            color: #fff;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }

        #bookingForm  button:hover {
            background-color: var(--secondary-color);
        }

        #bookingForm .ticket {
            margin-top: 20px;
            padding: 15px;
            border: 1px solid #ccc;
            background-color: #fff;
        }
     
        #bookingForm .icon {
            color: var(--accent-color);
            font-size: 24px;
            margin-right: 5px;
        }
    </style>
</head>

<body>

    <!--<div class="preloader">-->
    <!--    <div class="loader">-->
    <!--        <span></span>-->
    <!--        <span></span>-->
    <!--        <span></span>-->
    <!--        <span></span>-->
    <!--    </div>-->
    <!--</div>-->


    <?php include "header.php";?>


    <div class="breadcrumb breadcrumb-style-one">
        <div class="container">
            <div class="col-lg-12 text-center">
                <h2 class="breadcrumb-title">Book Your Tour</h2>
                <ul class="d-flex justify-content-center breadcrumb-items">
                    <li class="breadcrumb-item"><a href="<?php echo $wspath?>">Home</a></li>
                    <li class="breadcrumb-item active">Book Now</li>
                </ul>
            </div>
        </div>
    </div>
    <section id="booking">
        <div class="container">
        <h1><i class="fa fa-car text-warning"></i> Book Now</h1>
        <form action="#" method="POST">
            <div class="row py-4 my-4" style="box-shadow: rgba(0, 0, 0, 0.16) 0px 3px 6px, rgba(0, 0, 0, 0.23) 0px 3px 6px;">
                <div class="col-md-12 pkg_nm mb-4"><?php echo $tour_name;?> - <span> Rs.<?= $price?>/-</span></div>
                <div class="col-lg-6">
                    <label for="name">NAME <span style="color:red;">*</span></label>
                    <input type="hidden" name="tour_name" value="<?php echo $tour_name;?>">
                    <input type="text" name="name" placeholder="Your Name" required>
                </div>
                <div class="col-lg-6">
                    <label for="mobile">MOBILE NO <span style="color:red;">*</span></label>
                    <input type="text" name="phone" maxlength="10" placeholder="Mobile Number" required>
                </div>
                <div class="col-lg-6">
                    <label for="email">EMAIL ID <span style="color:red;">*</span></label>
                    <input type="email" name="email" placeholder="Your Email" required>
                </div>
                <div class="col-lg-6">
                    <label for="date">Date of Travel <span style="color:red;">*</span></label>
                    <input type="date" name="date" id="date" required min="<?php echo date('Y-m-d'); ?>">
                </div>
                <div class="col-lg-6">
                    <label for="date">Your Car <span style="color:red;">*</span></label>
                    <input type="text" name="car_type" id="car_type" required readonly value="<?= $car_type?>">
                </div>
                <!--<div class="col-lg-6">-->
                <!--    <label for="destination">Select Car<span style="color:red;">*</span></label>-->
                <!--    <select id="destination" name="car_type" onchange="updateFare()" >-->
                <!--    <option value="">Choose Your Car</option>-->
                <!--    <option value="Swift Dezire">Swift Dezire</option>-->
                <!--    <option value="Innova Crysta">Innova Crysta</option>-->
                <!--    <option value="Ertiga">Ertiga</option>-->
                <!--    </select>-->
                <!--</div>-->
                <div class="col-lg-6">
                    <label for="fare">Booking Amount</label>
                    <input type="text" name="price" id="fare" readonly value="<?= $price?>">
                </div>
                <div class="col-lg-12">
                    <button class="w-100 py-2 bg-primary border-0 text-white" type="submit" name="booking"><i class="fa fa-check text-warning"></i> Pay Now</button>
                </div>
            </div>
         </form>
        </div>
    </section>
    
    <?php include "inner-footer.php";?>
    
    <?php include "footer.php"?>
    <!--<script>-->
    <!--    function updateFare() {-->
    <!--        var numberOfPersons = document.getElementsByName("accomodation")[0].value;-->
    <!--        var farePerPerson = <?php echo $price;?>;-->
    <!--        var totalFare = numberOfPersons * farePerPerson;-->
    <!--        document.getElementsByName("price")[0].value = totalFare;-->
    <!--    }-->
    <!--</script>-->
    <script>
    document.addEventListener('DOMContentLoaded', function () {
        var nameInput = document.querySelector('input[name="name"]');
        
        nameInput.addEventListener('input', function () {
            nameInput.value = capitalizeFirstLetter(nameInput.value.trim());
        });

        function capitalizeFirstLetter(str) {
            return str.charAt(0).toUpperCase() + str.slice(1);
        }
    });
</script>
    <script>
    document.addEventListener('DOMContentLoaded', function () {
        document.querySelector('form').addEventListener('submit', function (e) {
            var valid = true;

            // Mobile number validation
            var phoneInput = document.querySelector('input[name="phone"]');
            if (!/^\d{10}$/.test(phoneInput.value)) {
                setError(phoneInput, 'Please enter a valid 10-digit mobile number.');
                valid = false;
            } else {
                clearError(phoneInput);
            }

            // Email validation
            var emailInput = document.querySelector('input[name="email"]');
            if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(emailInput.value)) {
                setError(emailInput, 'Please enter a valid email address.');
                valid = false;
            } else {
                clearError(emailInput);
            }

            // Date validation
            var dateInput = document.querySelector('input[name="date"]');
            var currentDate = new Date();
            currentDate.setHours(0, 0, 0, 0); // Set time to midnight
            var selectedDate = new Date(dateInput.value + 'T00:00:00+05:30'); // Assume Indian time zone (GMT+5:30)

            // Check if the selected date is before the current date
            if (selectedDate.getTime() < currentDate.getTime()) {
                setError(dateInput, 'Please select an upcoming date.');
                valid = false;
            } else {
                clearError(dateInput);
            }

            // Car type validation
            var carTypeInput = document.querySelector('select[name="car_type"]');
            if (carTypeInput.value === '') {
                setError(carTypeInput, 'Please choose a car type.');
                valid = false;
            } else {
                clearError(carTypeInput);
            }

            // Prevent form submission if validation fails
            if (!valid) {
                e.preventDefault();
            }
        });

        function setError(input, message) {
            input.classList.add('is-invalid');
            var errorElement = document.createElement('div');
            errorElement.className = 'invalid-feedback';
            errorElement.innerText = message;
            input.parentNode.appendChild(errorElement);
        }

        function clearError(input) {
            input.classList.remove('is-invalid');
            var errorElement = input.parentNode.querySelector('.invalid-feedback');
            if (errorElement) {
                errorElement.parentNode.removeChild(errorElement);
            }
        }
    });
</script>


</body>
    
</html>

MMCT - 2023