I'm sure there's a better way to do this, but I'm still learning so go easy....
I'm trying to write a function that will print out options for a select menu. For the current month, I want to add one month to it and make that option the default checked one. I tried to use the following, but it keeps defaulting to February, which means that the part where it should get the month isn't working. :/
I'm new to functions and I must be doing something wrong, but I can't figure it out. Help?
function print_months_d() {
for ($i=1; $i<=12; $i++) {
$param1=date('n');
if($i == $param1) { // NOTE: I tried the opposite verbage as well (i.e., $param1 == $i
$month_number = $i + 1;
$month = date('F',mktime(0,0,0,$month_number));
echo "<option value=\"$month_number\" CHECKED>$month</option>";
} else {
$month_number = $i;
$month = date('F',mktime(0,0,0,$month_number));
echo "<option value=\"$month_number\">$month</option>";
}
}
}