Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2014
    Posts
    6

    Unanswered: Hotel reservation Site

    Hi I am building this hotel reservation site for a small hotel. The user interface is ready and I have a form that clicking on submit inserts the data into MySQL. My question is where do I go from here? Besides inserting the form data I should be able to verify which rooms are available on a date. Since the hotel is empty when starting should list all the room types singles, doubles etc. After the first booking that room should not be available. Also is my database design right? Here is what I have. Thanks for your help.

    TABLES

    bookings:

    id int11 auto increment primary key
    arrival date
    departure date
    adults int3
    children int3

    customers:

    id int11 auto increment primary key
    first_name varchar30
    last_name varchar 30
    address varchar100\phone int11
    city varchar30
    country varchar30

    rooms:

    roomID int11 auto increment primary key
    location varchar20
    room_number int11
    room_typeID int11

    room_types:

    room_typeID int11 auto increment primary key
    room_type vatchar20
    num_beds int11
    price_night int20

    <form name="form1" method="post" action="process.php">
    <table border="1" cellspacing="5" cellpadding="4">
    <tr><td colspan="2" class="txt"><h2>Book Now</h2></td></tr>

    <tr><td colspan="2">&nbsp;</td></tr>

    <tr><td class="txt">Arrival:</td><td><input type="text" name="arrival" size="15"></td></tr>

    <tr><td class="txt">Departure:</td><td><input type="text" name="departure" size="15"></td></tr>

    <tr><td class="txt">Adults:</td><td>

    <select id="adults" name="adults">
    <option <?php if ($adults == 1 ) echo 'selected'; ?> value="1">1</option>
    <option <?php if ($adults == 2 ) echo 'selected'; ?> value="2">2</option>
    <option <?php if ($adults == 3 ) echo 'selected'; ?> value="3">3</option>
    <option <?php if ($adults == 4 ) echo 'selected'; ?> value="4">4</option>
    </select></td></tr>


    <tr>
    <td class="txt">Children:</td><td>

    <select id="children" name="children">

    <option <?php if ($children == 0 ) echo 'selected'; ?> value="0">0</option>
    <option <?php if ($children == 1 ) echo 'selected'; ?> value="1">1</option>
    <option <?php if ($children == 2 ) echo 'selected'; ?> value="2">2</option>
    <option <?php if ($children == 3 ) echo 'selected'; ?> value="3">3</option>
    <option <?php if ($children == 4 ) echo 'selected'; ?> value="4">4</option>
    </select></td></tr>
    <tr><td colspan="2">&nbsp;</td></tr>
    <tr><td>&nbsp;</td><td><input type="submit" name="submit" value="Submit"></td></tr>
    </table>


    <?php include("./includes/connect.php"); ?>

    <?php

    // Get values from form
    $arrival=$_POST['arrival'];
    $departure=$_POST['departure'];
    $adults=$_POST['adults'];
    $children=$_POST['children'];

    // Insert data into mysql
    $sql="INSERT INTO $tbl_name(arrival, departure, adults, children)VALUES('$arrival', '$departure', '$adults','$children')";
    $result=mysql_query($sql);

    // if successfully insert data into database, displays message "Successful".
    if($result){
    echo "Successful";
    echo "<BR>";
    echo "<a href='index.php'>Back to main page</a>";
    }

    else {
    echo "ERROR";
    }
    ?>

    <?php
    // close connection
    mysql_close();
    ?>
    </form>

  2. #2
    Join Date
    Jul 2015
    Posts
    6
    If this is for a real site and not, let's say, a college exercise, you should have downloaded something opensource, it will be many times more reliable and polished than something you could write yourself. I'd genuinely give up on this and get something opensource and skin it, it will save you a lot of time in the long run.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •