hey guys, i got a question which stuck my brain few days and here is it.

i studies some drop down list tutorial but some how i still have no idea to generate a three level drop down list by which value of the drop down list is dynamic, mean which value is retrieve from DB but not set by static.

Here is my case:

I developing a car rental web system. I need to prompt user input the car tranmission, car model, and car plate no, so i wish to done this in drop down list form. Means, user firstly select the 1st drop down list, to select the car transmission mode for example manual, base on the transmission type, the 2nd drop down list will only show the car model which have manual mode, after the user selected the car model, lets said Lotus, the last drop down list will only show the car plate no which is lotus model and manual mode.

Any 1 have idea or have any reference can share with me ? appretiate your help, TQ

(P/S: im write my system in JSP n MySQL)

Recommended Answers

All 6 Replies

if you do not want to refresh the page between each selection then you will need to use ajax to populate the dropdowns.

you can get started with w3schools tutorial.

other than AJAX, is that any other solution ? because i never touch AJAX before

its not VERY complicated, basicly its just the page calls a different page request to the server and uses javascript to dynamicly update the current page with the response, without ever refreshing the current page! ~

but if really you dont wanna do that, you can work with refreshes , everytime you change the first dropdown you redirect to the same page with the selected id in the querystring and on page load you check for such querystring parameters to correctly set the selected item of the first dropdown and correctly load the good items in the second drop down!

Hey Philippe, can you share some reference or tutorial with me, because i totally no idea with ajax...

there is a link to w3 schools in my first reply on this thread, when i had absolutly no experience with ajax, a quick read through their material allowed me to custom a simple example to what i needed to do within a few hours :) its by far your best bet for starting out

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.