One choice for each year from last year to five years from now
<?
$months = array(1 => 'January', 2 => 'February', 3 => 'March', 4 => 'April',
5 => 'May', 6 => 'June', 7 => 'July', 8 => 'August',
9 => 'September', 10 => 'October', 11 => 'November',
12 => 'December');
print '<select name="year">';
for ($year = date('Y') -1, $max_year = date('Y') + 5; $year < $max_year; $year++) {
print '<option value="' . $year . '">' . $year ."</option>\n";
}
print "</select> \n";
?>
Related examples in the same category