Populating drop downs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey all,

Since I get so much great info and help from the lists I'm on, every now and then I like to try and give something back.

I just finished some code that is pretty useful for populating one drop down based on the selection of a previous one, so I thought I'd pass it along in case anyone found it useful. I'm sure many of you already have a way to do this in your toolbox, but thought some may not.

I've seen many examples of doing this Googling around, but found them overly complex, and I think I've come up with a quite simple and affective way to do it with not too much code.

Basically, I had a need to populate a dropdown containing areas within the boroughs of New York City based on which borough was selected. So say they select Manhattan in the first dropdown, the second dropdown then becomes populated with the areas within Manhatan.

The code builds the possible arrays for the second dropdown from the database when the page loads, then plugs them directly into the JS, making the whole arrangement dynamic. Change the DB and the dropdown adjusts accordingly.

If you'd like to see the code email me off list and I'll pass it along.

--
Skip Evans
Big Sky Penguin, LLC
61 W Broadway
Butte, Montana 59701
406-782-2240

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux