1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to perform multiple calculations using php

Discussion in 'PHP' started by tanoloo1, Jul 18, 2012.

  1. #1
    Hi, am new to php coding but through help from other PHP programmers, I have been able to come up with an online hotel reservation system as you can see on this link: http://sunsethotel.x10.bz/index.php
    This website is working but I would like to make some modifications in the reservations engine. The hotel has 5 different types of rooms and each room has an id i.e from 1-6. Each room also has a meal plan of Bed Only (BO), Half Board (HB) and Full Board (FB) with the prices stored in the database.


    On this page:http://sunsethotel.x10.bz/testing.php, I would like to include a drop down list on each of the rooms displayed so that the customer can select the meal plan before making a reservation.


    Upon clicking the "reserve" button, the prices should be retrieved from the database based on the meal plan and room id, perform a calculation and post the results back to the database.


    This website currently does this calculation but only for Full Board (FB) and not for Bed Only (BO) or Half Board (HB).


    Would someone with an idea assist please?
     
    tanoloo1, Jul 18, 2012 IP
  2. superlinksworld

    superlinksworld Member

    Messages:
    127
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    43
    #2
    Hi,

    You can store meal plan in database for each room ..then you can pull that from database in <select> tag

    for Example

    
    <label><span class="small">Select Meal  </span></label>       <select name="meal">
                                     <option selected value="Choose">Choose</option>
                                     <? 
                                      //Ftech All meals
                                     $mealquery = mysql_query("SELECT * FROM rooms where roomid='$roomid'");
                                     while ($meal = mysql_fetch_array($mealquery)) {
                                         
                                         echo '<option value="'.$meal['id'].'">'.$meal['meal_price'].'</option>';
                                         
                                     }
                                     ?>
    
    
    Code (markup):
    then you can calculate price esaily when user select .

    If you show me full code and database structure i can help in more details.

    regards,

    D Najmi
     
    superlinksworld, Jul 18, 2012 IP