Re: html form question
| From: | Matt Greer | Date: | Thu, 26 Jul 2001 01:09:25 +0000 |
| Subject: | Re: html form question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-59652@lists.php.net to get a copy of this message | ||
> What's the method for populating any number of html
> form <option>...</option> tags with query results?
> I've seen lots of php-embedded examples for CHECKBOX,
> RADIO and even SELECT, but I can't seem to figure out
> how to create a simple drop-down menu. HELP!!!
Wouldn't it just be:
<select name="menu">
<option value="<?php echo $firstoptionvalue; ?>"><?php echo
$firstoption; ?></option>
<option value="<?php echo $secoptionvalue; ?>"><?php echo
$secoption; ?></option>
</select>
If there's a varying number of options run a loop with arrays
<select name="menu">
<?php
for ($i = 0; $i < $numoptions; $i++)
echo "<option value='$optionvalue[$i]'>$option[$i]</option>
?>
</select>
Matt