Database value as selected in combo box!
[email protected] ("Anthony Judd") Sun, 2 Feb 2003 16:20:03 +1000
| Newsgroups | php.lang |
|---|---|
| Message-ID | <[email protected]> |
I am trying to display the current database value as SELECTED in a combo
box. Any ideas why this isn't working. (ID is being sent).
Would appreciate any help.
function retrieve_category()
{
$cat = mysql_query("SELECT category_id FROM category");
while ($current_row = mysql_fetch_row($cat))
{
if ($current_row[0] == $id)
{
printf("<option selected>%s</option>\n",$current_row[0]);
}
else
{
printf("<option>%s</option>\n",$current_row[0]);
}
}
}