[PHP] Populating a Dropdown Menu From a Query

2004-07-16 Thread Harlequin
Another day another conundrum. I have a form where one option is a dropdown menu. I'd like that menu to only have items in it that are actually available. Selecting the items with a query is easy enough but I wondered if anyone could tell me where to start wit the code. Am I using a for each

Re: [PHP] Populating a Dropdown Menu From a Query

2004-07-16 Thread Matt M.
I have a form where one option is a dropdown menu. I'd like that menu to only have items in it that are actually available. Selecting the items with a query is easy enough but I wondered if anyone could tell me where to start wit the code. I dont know what kind of db so I will just use mysql,

Re: [PHP] Populating a Dropdown Menu From a Query

2004-07-16 Thread Arnout Boks
The exact implementation differs with your database system, but as an example for MySQL: select name=select size=1 ?php $result = mysql_query($query); while($row = mysql_fetch_assoc){ echo(option value=\{$row['name_of_value_field']}\{$row['name_of_description_field']}