Skip to content
Advertisement

Booking-form dropdown menu (php)

I’m working on a hotel booking project (php) and I want to create a booking-form where I will have :

Checking Date(datepicker)

Checkout Date(datepicker)

Room type (Here I want to have a dropdown menu, <select><option>Single</option></select>, and when a option is selected to show me the price of that room type, without pressing any button.)

Price (this is a text, not a textbox)(And here I want to show me the price of that room type.)

I have the query that gives me the price data from table, put I don’t know how to show me without pressing any button, just when I select the “Single Room” option, the price field should be $30 (this is data from table, for example).

Can you give me an idea ? Is a specific function for <select> tag for this ?

JavaScript

This is my php code, but its work only if I hit ‘submit’. I want to work when I select the option.

Advertisement

Answer

Use the following example

JavaScript

and jquery

JavaScript

jsfiddle link http://jsfiddle.net/Mj4Vj/

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement