PDA

View Full Version : form changing


FrEaKmAn
February 9th, 2007, 10:08 PM
Hi

I need something, I checked few sites like irt.org, but I still can't find the right thing.

I have php site, which will be for hosting registration. Now I have packages, I enter Package name, price for 1, 3, 6, 12 months so 5 inputs. In the registration form I have drop down menu with Package names in it. I want when I select one Package that I have another drop down menu for prices. So if I pick anothor package, package prices should update.

I found few forms that can do this, but I can't or I don't know how to use them when I have to load data from database.

Buzz
February 10th, 2007, 12:45 AM
You need AJAX to dynamically generate content from a database without a page load.

http://www.w3schools.com/ajax/default.asp

degsy
February 10th, 2007, 02:23 PM
You have 3 options for dependent dropdowns

1) You need to submit the form so you can take the value from the first dropdown and use it in the query for the second.

2) You output all required data for the dropdowns and put them into an array.
This is basically a Javascript Dependent Dropdown.
http://www.javascriptkit.com/script/cutindex16.shtml

3) Ajax
I would recommend this method.
You use Ajax to call a server-side script with will return the results of the query and you can update the content in your page.

Here are a couple of sites I reference when using Ajax
http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm
http://www.captain.at/howto-ajax-form-post-get.php