PDA

View Full Version : populating Form Options from table


Trainacomin
1-15-05, 07:47 PM
I'm trying see if it's possible to populate an option on a form from one of my tables in my database. In my searching it appears it can be done but I can't find out how.
TIA
Clint

devinemke
1-15-05, 11:09 PM
a very simple example:

<form action="" method="POST">
<select name="options">

<?php
// assume already connected to db
$result = mysql_query('SELECT option FROM table');
while ($row = mysql_fetch_assoc($result))
{
echo '<option>' . $row['option'];
}
?>

</select>
<br>
<input type="submit" name="submit" value="submit">
</form>