Print current and next three years
| From: | Shaun | Date: | Wed, 24 Sep 2003 12:29:39 +0000 |
| Subject: | Print current and next three years | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-163717@lists.php.net to get a copy of this message | ||
Hi,
I am trying to print the current and next three years in a form. Using the
following code I can only print 2000, 2001, 2002, 2003:
<select name="start_date_year">
<?php
$i = 1;
while ($i <= 4){
if ($i + 1 == date("Y", strtotime($_GET[mysql_date]))){
echo '<option value="'.date("Y", mktime(0, 0, 0, 0, 0,
$i)).'"
selected>'.date("Y", mktime(0, 0, 0, 0, 0, $i)).'</option>';
} else {
echo '<option value="'.date("Y", mktime(0, 0, 0, 0, 0,
$i)).'">'.date("Y", mktime(0, 0, 0, 0, 0,
$i)).'</option>';
}
$i++;
}
?>
</select>
How can I get this code to start looping from the current year?
Thanks for your help