Can anyone shed some light on the following:
I want to use a drop down box for data entry, and if the value is already set go to that option value. If I do it as follows, all works well.
echo "<select name=\"Year\" value=\"$row->Year\">";
switch($row->zerotehaiYear)
{
case "":
$year_select_blank = "SELECTED";
break;
case "2001":
$year_select_2001 = "SELECTED";
break;
case "2002":
$year_select_2002 = "SELECTED";
break;
case "2003":
$year_select_2003 = "SELECTED";
break;
case "2004":
$year_select_2004 = "SELECTED";
break;
}
echo "<option value=\"0000\" $year_select_blank> SELECT YEAR";
echo "<option value=\"2001\" $year_select_2001> 2001";
echo "<option value=\"2002\" $year_select_2002> 2002";
echo "<option value=\"2003\" $year_select_2003> 2003";
echo "<option value=\"2004\" $year_select_2004> 2004";
echo "</select>";
But if I call the same from a function do_years('$name', '$value');
It stops working. Any ideas?