$current=date('Y'); for($i=0;$i<4;$i++){ echo $current + $i; }
Shaun wrote:
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
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php