drop down list of years puzzles me
| From: | Bill Green | Date: | Tue, 20 Jan 2004 23:10:09 +0000 |
| Subject: | drop down list of years puzzles me | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-175220@lists.php.net to get a copy of this message | ||
This works to create a drop down select box of numbers 1-12:
for($i=1; $i < 13; $i++) {
echo "<option value={$i}>".$i."</option>\n";
}
This doesn't to create a drop down box of years:
$curr_year = intval(date('Y'));
$range = 10;
for ($y=$curr_year; $y < $range; $y++) {
echo "<option value={$y}>".$y."</option>\n";
}
When I check for errors:
$curr_year = 2004
$curr_year is an integer
$range = 10
$curr_year + $range = 2014
$y = 2004
But my select box is empty... as in:
<select name='yada'>
</select>
What is it that I don't understand?
--
Bill
--