Reputation:
I'm writing a sign up form, and I have this:
<?php
for($j = 1; $j <= 12; $j++)
{
$month = date("F", mktime(0, 0, 0, j, 1, 2000));
echo '<option value="'.$month.'">'.$month.'</option>';
}
?>
The problem is that my select box shows 'January' 12 times, but I want January, February, March etc... through December. How can I fix this? Thanks.
Upvotes: 0
Views: 391
Reputation: 20446
syntax error? j
needs a $
:
$month = date("F", mktime(0, 0, 0, $j, 1, 2000));
Upvotes: 1
Reputation: 65639
Do you mean
$month = date("F", mktime(0, 0, 0, $j, 1, 2000));
Notice the $ on the j
Upvotes: 1
Reputation: 24182
You are missing a dollar sign in front of "j" here:
$month = date("F", mktime(0, 0, 0, j, 1, 2000));
Upvotes: 5