Hi All,
Can someone tell me why this isn't working? I have three dynamic dropdown boxes that should default to the database selection. They are the Month, Date and Year taken from a datetime field.
In my SQL statement, I have already re-formatted the values to print correctly:
$selMonth = $myrow[6];
$selDay = $myrow[7];
$selYear = $myrow[8];
echo "$selMonth<BR>$selDay<br>$selYear";
AS
August
25
2003
Here is my Month dynamic box:
<?
$months= array(1=>'January', 'February', 'March',
'April', 'May', 'June', 'July',
'August', 'September', 'October',
'November', 'December');
if(in_array($selMonth, $months)){
$selected = "selected";
}
else{
$selected = "";
}
echo "<select>\n";
for($count=1; $count<=12; $count++)
{
echo "<option $selected value=\"$count\">$months[$count]\n";
}
echo "</select>\n";
But the default is the last Month (December). I cannot get it to match my selMonth of August to the array value of August.
Any suggestions?
Thanks much.
Geogal
🙂