Page 1 of 1

List box which is populated by selecting from another

Posted: Wed Aug 29, 2007 3:39 pm
by davidtube
I've got a database table with categories and subcategories. I want users to select a category from a listbox then a second listbox will be populated with all the related subcategories. How do I go about this? I know how to populate the first listbox from the table.

Posted: Wed Aug 29, 2007 4:36 pm
by califdon
Do you need to get the data for the second dropdown from the database? If so, you need to make another query and either return a new html page (ugly) or use Ajax technique to return dynamic data for the existing page. In either case, you'll be writing Javascript code.

Posted: Wed Aug 29, 2007 6:02 pm
by CoderGoblin
Dynamic/Chained Selects using Ajax Prototype/JQuery has a couple of solutions although you will have to figure out the database retrieval.

Posted: Thu Aug 30, 2007 7:43 am
by davidtube
Thanks. I've got no AJAX experience but it's time I learned so that's ok. Thanks for pointing me in the right direction.