I am having a list box like this ,the list box is populated from the database
<td bgcolor="#FFFFCC">
<select name="listbox" id="FriendmailId" size="3" >
<option value="0">Select User From List</option>
<? foreach($searchfriend as $row)
{?>
<option value=""><?=$row['dEmailID'];?></option>
<? } ?>
</select>
</td>
The values are listed in the list box ….but the problem is when i select a item it is highted but not really selected why it is so
You need to add
selected="selected"for the option value you want selected:In a loop, this is usually done when a certain condition is met for an option to be selected (of course only one option can be selected at a time)
Note: If you don’t specify
selected="selected"for an option, by default, first option value is selected.