Open In App

Implementing A Webpage To Book Seat For Restaurant

Improve
Improve
Like Article
Like
Save
Share
Report

We all are facing a pandemic situation. But in this situation also, we all love to enjoy food at different restaurants. In the pandemic situation, all restaurants are running with 50% of customers. So before you go to enjoy your food, you have to register your seats at the proper time.

So we build a webpage for a particular restaurant that will take necessary details to book your seats and give you a confirmation message regarding that. This is important to take your food safely and maintain hygiene. We have created this by using HTML and PHP.

Approach: The main concept is that we are going to build a website that helps customers to book their seats to take their food safely and maintain hygiene. There will be a home page. After filling necessary details to book their seat a confirmation message will be generated. We have used two files index.html (Home page) and dine.php (Confirmation page).

At first, the home page will open and you have to fill in the necessary details. After that, a confirmation message will be generated. This facility helps customer to book their seat for that certain date only. The date will be taken from the device. The user should provide the Name, Number of Customers, Visiting Time. Also, the user has to upload vaccine certificates or PT-PCR test reports for all customers in the merged files.

Requirement:

  • index.html
  • dine.php

Steps To Execute:

  • At first, we have to build a form by using the <form> tag in HTML.
  • We will set the background color with light blue by using the help of the <style> tag.
  • We have to fill four fields. All of them are mandatory.  We have created the Name, Number of customers, and Time. At the time of booking, you have to upload RT-PCR Negative test reports or vaccine certificates in a merged file.
  • All the details are given manually. You have to submit your name, the number of customers, and the time. The time you will visit the hotel completely depends on the customer. The date will be automatically added. It will only book your request for that day only.
  • All the inputs will be taken by some variables which will transfer to the next page for showing the details.
  • On the next page, we will define the PHP file where we will show the necessary details. In the PHP file, we will use $_GET to take values from the previous page to this page. Also on this page, your booked table number will be produced.
  • We will use the PHP date() function. The format will be date(“Y/m/d”). It will take the present date and it will show the date on the result page. Every day the date will change as it is taking the current date.

Example: Below is the implementation of the above process:

index.html




<!DOCTYPE html>
<html>
  
<head>
    <title>Only Ghosals'</title>
  
    <style>
        body {
            background-color: lightblue;
        }
    </style>
</head>
  
<body>
    <center>
        <h2>Only Ghosals' Restaurant</h2>
        <h2>11, Dayal Banerjee Road</h2>
        <h2>Shibpur, Howrah-711102</h2>
        <h3>Mask & Sanitizer Are Mandatory</h3>
        <h3>
            Upload RT-PCR Negative Test Report 
            Or Two Dose Of Vaccine Certificate
        </h3>
          
        <h3>***Booking Only For Today***</h3>
        </br></br>
  
        <form action="dine.php" method="get">
            <table>
                <tr>
                    <td>Name:</td>
                    <td><input type="text" name="name" 
                        required /><br /><br />
                    </td>
                </tr>
                <tr>
                    <td>Total Number Of Customer:</td>
                    <td><input type="text" name="val" 
                        required /><br /><br />
                    </td>
                </tr>
                <tr>
                    <td>Time (12 Hours Format):</td>
                    <td><input type="text" name="time" 
                        required /><br /><br />
                    </td>
                </tr>
                <tr>
                    <td>
                        Upload Certificates Or Test 
                        Reports(Merged Files):
                    </td>
                    <td><input type="file" id="myfile" 
                        name="myfile" required /><br /><br />
                    </td>
                </tr>
                <tr>
                    <td><input type="submit" name="submit" 
                        value="Submit" />
                    </td>
                </tr>
            </table>
        </form>
    </center>
</body>
  
</html>


  • dine.php: The following code is used in the above HTML code.

dine.php




<!DOCTYPE html>
<html>
  
<head>
    <style>
        body {
            background-color: lightblue;
        }
    </style>
</head>
  
<body>
    <?php
    echo "<h2>
<p><center>
        Only Ghosals' Restaurant</p>
</h2>";
    echo "<h2>
<p><center>
        11, Dayal Banerjee Road</p>
</h2>";
    echo "<h2>
<p><center>
        Shibpur, Howrah-711102</p>
</h2>";
    echo "</br>";
    echo "<h2>
<p><center>
        Name : " . $_GET['name'] . ". </p>
</h2>";
    echo "<h2>
<p><center>
        Booked For Today " . date("Y/m/d") . "</p>
</h2>";
    echo "<h2>
<p><center>
        Time : " . $_GET['time'] . ". </p>
</h2>";
    echo "<h2>
<p><center>
        Total Number Of Customer : " 
        . $_GET['val'] . ". </p>
</h2>";
    echo "<h2>
<p><center>
        Table Number Booked: 32";
    echo "</br>";
    echo "<h3>
<p><center>
        Take A Screenshot For Further Use At Hotel</p>
</h3>";
    echo "<h3>
<p><center>
            Please Bring All Certificates Or Test Reports 
            At Visiting Time</p>
</h3>";
    echo "</br>";
    ?>
</body>
  
</html>


Output:



Last Updated : 25 May, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads