Related Dropdown Lists

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mustafamisir
Forum Newbie
Posts: 23
Joined: Wed Jun 22, 2005 1:00 pm
Contact:

Related Dropdown Lists

Post by mustafamisir »

Hi,

I have two dropdown lists. These lists take their values from database. The first lists have some titles. When you choose one, the second one's lists must be change according to the first one.

How can I do this?
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

The term for that is "Chained Selectors". Google for that, and possibly "Javascript" as well.

http://www.mattkruse.com/javascript/dynamicoptionlist/

Does almost exactly what you describe. Hope that helps.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

There's also CoderGoblin's tutorial (in the tutorial section here)
User avatar
harrisonad
Forum Contributor
Posts: 288
Joined: Fri Oct 15, 2004 4:58 am
Location: Philippines
Contact:

Post by harrisonad »

Hi. I also used that trick and I a bothered by it's slow performance when the number of items are large. The page will load after about 3 seconds(not including the graphics) and the form events will consume another 5 seconds to refresh the list.

Because of this, I prefer to load the page when an item of the first select box is selected.
Last edited by harrisonad on Wed Aug 03, 2005 7:44 pm, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

if the page requires faster response, but the drop downs can be a bit slower, you can always transport the data over XMLHTTP or other protocols..
Post Reply