Hello - I'm looking for code that will produce a drop-down that will always list the current year plus two years prior and two two years in the future?
This year would display:
2003 2004 2005 2006 2007
Next year would display:
2004 2005 2006 2007 2008
Thanks!
$year = date('Y'); $years = range($year - 2, $year + 2); echo '<select name="years">'; foreach ($years as $value) {echo '<option>' . $value;} echo '</select>';
conceptually...
$y = date("Y") - 2; for ($i=$y; $i<$y+5; $i++) { echo "$i\n"; }
I love genious people! Thanks for your replies. I tried yours KBurger and it worked like a charm!
First I've seen the ability to count to five described as genius 🙂