View Single Post
Old 02-16-2006, 08:19 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,529
sde is on a distinguished road
personally I would use date("Y") so you have the 4 digit year. since they don't start with "0" you won't have this problem.

you could also create a string array with predefined dates:
PHP Code:
<?
$years 
= array("06","07","08","09","10");
foreach (
$years as $year) {
  echo 
"<option value='".$year."'>".$year."</option>\n";
}
?>
or str_pad if you want to keep using your way
PHP Code:
<?
$year 
date("y");

while(
$year 10) {
  
$year str_pad($year2"0"STR_PAD_LEFT);

  echo 
"<option value='".$year."'>".$year."</option>\n";

  
$year++;
}
?>
hth
sde is offline   Reply With Quote