HOW TO PERFORM MULTIPLE CALCULATIONS USING PHP

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?

Hello Tanoloo1,

I just saw your site and I think it looks nice. This is a question rather than a reply.

I’m new to programming myself (very new , actually) and was wondering how you applied the month-calendar that appears on arrival and departure date box? Is it some sort of plug-in.

Thanks,
Chris

First use HTML to create the drop down options with the meal plan.
Second use a WHERE statement in your SQL database query to get the prices from the database according to the meal plan selected.
Third once you have the prices set them to variables in php and do the calculations.

I hope this made since if you need help with the code let us know.

What the customer does:
Visits page->enters number of occupants->selects meal plan-> hits reserve->sees price and completes registration.

what the computer does
gets number of occupants and meal plan from customer -> queries database for prices-> sets customer submissions and database info to variables-> does calculations -> shows user the price.

Hi Chris,
Its not a plug-in.
Here is the code:

Here is the form:


Arrival:


Departure:

Hope it helps

Hi Andrew,
Your explanation makes it appear so simple and straight forward.
Would you help with sample code?

Sponsor our Newsletter | Privacy Policy | Terms of Service