Hope it helps a bit
Mike Karthauser wrote:
I'm using the contents of a table to print an option list in another form to
allow me to cross reference the tables in my data.
<? $result = mysql_query("SELECT * FROM category",$db);
printf("<select name=\"catcode\">\n");
while ($myrow = mysql_fetch_array($result)) {
if ($valuefromdatabase == %s ) {
printf("<option value=\"%s\" selected>%s</option>\n", $myrow["catcode"],
$myrow["title"]);
}
else {
the above without selected
}
}
printf("</select>\n");
?>
Once i have selected from the drop box the variable is submitted back to my
table and saved.
When re-edit the data - the record already has a value for catcode which i
want to reflect within the drop box - in html it would be the addition of
selected="selected" within the <option>.
Are there any recommended methods of doing this?
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php