Selected Value!
| From: | Anthony Judd | Date: | Sun, 02 Feb 2003 06:21:22 +0000 |
| Subject: | Selected Value! | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-18294@lists.php.net to get a copy of this message | ||
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)
Any help is appreciated..!
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]);
}
}
}