View Single Post
Old 02-16-2006, 08:01 AM   #1 (permalink)
draven77
Recruit
 
Join Date: May 2005
Posts: 13
draven77 is on a distinguished road
Easy (for you ninjas) loop question

Hey guys,
really dumb question that I know has a simple answer...

I have this loop that generates a dropdown list for years. The problem is that the first current year it grabs initially is great (06) after it is incremented, I loose my "0" before the 6.. i.e...

Returns: 06,7,8,9
Instead of: 06,07,08,09

I'm sure there's a function or something that preserves the double, but can't seem to find it.

Here's the loop
Code:
<select name="expire_year">
<?
$curYear = date("y");
$yearCount = 1;

   echo "<option value='' SELECTED>- Select -</option>\n";

while ($yearCount < 10) {
   echo "<option value='".$curYear."'>".$curYear."</option>\n";

   $yearCount ++;
   $curYear ++;
}
?>
</select>
draven77 is offline   Reply With Quote