Greetings, For some reason the code below is producing (2) Marches and no February in the dropdown. Can some experts lend advice? Jan Mar Mar April May etc <select name=month> <? for($m = '1'; $m <= '12'; $m++) { $MonthWord = date('F', mktime(0,0,0,$m,date(d),date(Y))); if($m == date(n) || $m == $_POST[month]) { echo "<option value=$m selected>$MonthWord</option>"; } else { echo "<option value=$m>$MonthWord</option>"; } } ?> </select> <select name=day> <? for($d = '1'; $d <= '31'; $d++) { if($d == date(j) || $d == $_POST[day]) { echo "<option value=$d selected>$d</option>"; } else { echo "<option value=$d>$d</option>"; } } ?> </select> <select name=year> <? for($y = '2005'; $y <= date(Y); $y++) { if($y == date(Y) || $y == $_POST[year]) { echo "<option value=$y selected>$y</option>\n"; } else { echo "<option value=$y>$y</option>\n"; } } ?> </select> Code (markup):
Well first off there is no Feb 29th or Feb 30th so that would not work from the 29th on in any month... try this instead: <?php $day=1; $year=date(Y); $year=2008; for($mon=1; $mon<=12; $mon++) { echo "<option>".date('F',mktime(0,0,0,$mon,$day,$year))."</option>\n"; } ?> Code (markup):
It is very important to understand WHY that worked. I posted the code so you can learn form it with an explanation as to why yours failed. As you just saw sometimes you can be a little too dynamic. Have a great day.