Re: [PHP] Dynamic Year Drop Down

2006-11-16 Thread Albert Padley
Thanks, Larry. This was close, but didn't quite work. I played around with the syntax and the following worked great. $this_year = date('Y'); echo "\n"; for ($i= $this_year-1; $i < $this_year+3; ++$i) { echo "" . $i . "\n"; } echo "\n"; Al Padley On Nov 16, 2006, at 11:32 PM, L

Re: [PHP] Dynamic Year Drop Down

2006-11-16 Thread Albert Padley
On Nov 16, 2006, at 11:04 PM, Tom Ray [Lists] wrote: Albert Padley wrote: I want to build a select drop down that includes last year, the current year and 3 years into the future. Obviously, I could easily hard code this or use a combination of the date and mktime functions to populate

Re: [PHP] Dynamic Year Drop Down

2006-11-16 Thread Larry Garfield
Quite simple: $this_year = date('Y'); for ($i= $this_year-1; $i < $this_year+3; ++$i) { print "$i\n"; } Obviously modify for however you're doing output. (Note that you DO want to have the redundant value attribute in there, otherwise some Javascript things don't work right in IE. Good habi

[PHP] Dynamic Year Drop Down

2006-11-16 Thread Albert Padley
I want to build a select drop down that includes last year, the current year and 3 years into the future. Obviously, I could easily hard code this or use a combination of the date and mktime functions to populate the select. However, I'm looking for a more elegant way of doing this. Thank