Drop down box that populates another form control

Soldato
Joined
31 May 2006
Posts
4,239
Location
127.0.0.1
Hi all

You've probably seen these on websites like Autotrader. When you choose the make of car (Ford, BMW etc...) then it automatically populates the next field with the model (Focus, Fiesta, 3 Series etc...). Anyone got a link of how to do that in either Java or ASP? I want the contents to be database driven.

Thanks in advance
 
Clarkey said:
is done with javascript, fairly simple.

Thanks but got a link for some example code?

Jaffa_Cake said:
I would output the js using PHP so you don't have to use Java. That or you can AJAX it with some flashing lights etc :D

Errrrr.....
tonyyeb said:
Anyone got a link of how to do that in either Java or ASP?

No PHP.... just Java and/or ASP. Got a link for the Java?
 
Just confirming you know java and javascript are different things?

Errrrr.....

If you want it to be database driven you have a PHP file which gets the list of options from the database then

Code:
echo "<option id='" . $row['id'] . "'>" . $row['text'] . "</option";

MSN me if you need some help with it :-)
 
Jaffa_Cake said:
Just confirming you know java and javascript are different things?



If you want it to be database driven you have a PHP file which gets the list of options from the database then

Code:
echo "<option id='" . $row['id'] . "'>" . $row['text'] . "</option";

MSN me if you need some help with it :-)

Hi - yes javascript is what im after - and no i don't want PHP code. From your PHP example you have not understood what i want. I want it so that when you choose the first drop down box, the second drop down box is populated with the data determined from the first one. The second drop down box is hence dynamic and relates to the users selection of an item in drop downbox 1. Look at http://www.autotrader.co.uk for a working example of what i want.
 
Its impossible to make it database driven if you don't use a server side scripting language such as PHP :)

You can do it with JS only easily enough if you update your JS file everytime you want to add a new option.

Sorry im not being much help here. Its difficult to get an example without first establishing exactly what you want :)
 
Last edited:
Back
Top Bottom