Re: Using a drop down box with an udetermined field amount
| From: | sven | Date: | Tue, 15 Jul 2003 09:16:07 +0000 |
| Subject: | Re: Using a drop down box with an udetermined field amount | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-155248@lists.php.net to get a copy of this message | ||
hi ron,
there are 2 steps to do this:
1. get data from mysql
(you can use 'group by' in your select-query for doubles, maybe some kind
of sort)
2. create your '<select>'
for each mysql-row create your '<option
value="$var1">$var2</option>'
(if you like, add some logic for 'selected')
close you '</select>'
ciao SVEN
Ron Allen wrote:
> What I want to do:
> Have a person input information about individuals into a database.
> One of the fields in the database will be Unit.
> On a form one of my drop down menu's will be Unit. I would like to
> have the PHP page poll the Unit field in the database and send all
> the different Unit results to the drop down box.
>
> Unit:<td><INPUT SIZE=6 NAME="Unit" value="">
>
> This would be an example of the information that would be an entered
> H Co
> H Co
> B Co
> A Co
> K Co
>
> This should be the results
> H Co
> B Co
> A Co
> K Co
>
> Any help would be appreciated!