Code for Changing YYYY in Dropdown Box.
Posted: Sun Jan 31, 2010 3:55 pm
I have a PHP string as follows:
selectList( "field_4_YYYY", $_POST["field_4_YYYY"], date("Y")-18, date("Y"), "YYYY", $style ) ;
This (the -18) allows my dropdown box to display the year going back to 1992, which is what I want. However, it also displays all the years to present, as in 2008, 2009 & 2010, which is what I don't want. I only want the available years in the dropdown box to display 1992, 1993, 1994 & 1995.
Can someone please show me what changes need to be made to this string to do that that will automatically update annually? I want the years to always remain at between 15 to 18 years back. Thanks you!
selectList( "field_4_YYYY", $_POST["field_4_YYYY"], date("Y")-18, date("Y"), "YYYY", $style ) ;
This (the -18) allows my dropdown box to display the year going back to 1992, which is what I want. However, it also displays all the years to present, as in 2008, 2009 & 2010, which is what I don't want. I only want the available years in the dropdown box to display 1992, 1993, 1994 & 1995.
Can someone please show me what changes need to be made to this string to do that that will automatically update annually? I want the years to always remain at between 15 to 18 years back. Thanks you!