[ciapug] Two dynamic drop downs

David Champion ciapug@cialug.org
Wed, 27 Oct 2004 14:41:57 -0500


Chris Hettinger wrote:

> Perhaps someone has a solution to this,
> 
> In a web form I have two drop downs that I need to build dynamically. 
> The first drop down is a main category and the second drop down box is 
> populated with appropriate options once the first drop down selection 
> has been made.
> 
> This has to be done with some melding of JavaScript and PHP, but I 
> haven't found the best way to solve this yet.
> 
> Just curious if anyone else had done something similar and could let me 
> of a good JS script to use or psuedo code of how they solved it.
> 

Barry recently did some javascript voodoo on the iowarealty.com web site 
to do rotating images... the PHP code builds a Javascript array, which 
loops thru the images. You could probably do something similar - load a 
javascript array, and in your onchange for the first control, have it 
load the second one from the array.

-dc