[PHP-DB] Re: Populating drop downs
by Manuel Lemos other posts by this author
Jul 29 2006 2:51PM messages near this date
[PHP-DB] Populating drop downs
|
[PHP-DB] Forms with letter verification
Hello,
on 07/29/2006 03:30 PM Skip Evans said the following:
> 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.
Most of the solutions I have seen only allow to link 2 or at most 3
select inputs. Another common limitation is that they only work with
MySQL database queries.
Look here if you are searching for a solution that interconnects an
unlimited number of inputs and can work with many other database types
besides MySQL (say PostgreSQL, SQLite, Oracle, Microsoft SQL server or
Microsoft Access, etc..):
http://www.phpclasses.org/formsgeneration
Here you may see a example form in action with 3 linked selects:
http://www.phpclasses.org/browse/file/9879.html
--
Regards,
Manuel Lemos
Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Thread:
Skip Evans
Manuel Lemos
|