Hi,
I have a drop down list which is populated by querying a database, and the selected item will be inserted into a different table.
However if the table already contains something that item will be selected first in the drop down list.
My problem is that if the table has nothing in it the drop down list will automatically select the first item in the drop down list, this could confuse the user, how could i get the default item to be blank then the drop down list therefore informing the user that nothing has been selected so far.
Thanks in advance (my code is below)
<?
print "<form action=\"advisers.php\" method=\"post\">
<select name=\"RegCode\">";
for ($i=0; $i<$number; $i++) {
$RegCode = mysql_result($result2,$i, "RegCode");
$Registrar = mysql_result($result2,$i, "Registrar");
print "<option value=".$RegCode;
if ($RegCode==$origr)
{
print " selected ";
};
print ">".$Registrar."</option>\n";
};
?>