holding values in a select list on a form
| From: | Mark Bayfield | Date: | Mon, 23 Jul 2001 09:34:13 +0000 |
| Subject: | holding values in a select list on a form | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-59163@lists.php.net to get a copy of this message | ||
Some help please...
I am creating a select list from a database, and I am trying to hold the
value of what has been selected by a user, while I do some error checking.
It is searching a mysql db to pull out the list. It will then need to pass
values back into the database. The code I am using is this...
<? echo "<select name=\"FIELDNAME\">";
print "<option value=\"\">Select</option>";
for ($index = 0; $index < mysql_num_rows($query); $index++) {
$row = mysql_fetch_row ($query) or die (mysql_error());
print "<option value=$row[1]>$row[1]</option>";
}
echo "</select>";
?>
If there is an easier way, let me know....
Mark