tags:

views:

67

answers:

5

Hi,

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.

+5  A: 

You are missing a dollar sign in front of "j" here:

$month = date("F", mktime(0, 0, 0, j, 1, 2000));
Palantir
Yep, you are right. It works now. Thanks!
Time Machine
+1  A: 

Do you mean

$month = date("F", mktime(0, 0, 0, $j, 1, 2000));

Notice the $ on the j

Doug T.
+1  A: 

It's $j.

$month = date("F", mktime(0, 0, 0, $j, 1, 2000));
erenon
+1  A: 

Should it be

mktime(0, 0, 0, $j , 1, 2000));

$j instead of j

ILMV
+1  A: 

syntax error? j needs a $:

$month = date("F", mktime(0, 0, 0, $j, 1, 2000));

dnagirl