ringo
01-17-2005, 02:08 PM
while ($row = mysql_fetch_row($result))
{
$str .='<option value='.$row[0].'';
if ($row[0] == $UserID)
{
$str .='selected="selected"';
}
$str .= '>'.$row[1].'</option>';
}
echo $str;
My code is not working. I retrieved everything from the database. Let's say the drop down list has 10 values and UserID=4. But when I view the page, the 4th option is not selected. Instead the 1st option is selected. Why is that so?
{
$str .='<option value='.$row[0].'';
if ($row[0] == $UserID)
{
$str .='selected="selected"';
}
$str .= '>'.$row[1].'</option>';
}
echo $str;
My code is not working. I retrieved everything from the database. Let's say the drop down list has 10 values and UserID=4. But when I view the page, the 4th option is not selected. Instead the 1st option is selected. Why is that so?