• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to preselect a year already set in DB?

#1
[eluser]123wesweat[/eluser]
Hi,

i am having troubles with preselecting a yeaer which has already been set (from db).

Code:
<?=form_dropdown('endYear', getYears(),'','id="endYear"');?>
and this is a simple getYears function
Code:
function getYears(){
    $yearOptions = array();
    $yearOptions[''] = 'Select year';
    for ($i=2015;$i>1940;$i--) {
        $yearOptions[$i] = $i;
    }
    
    return $yearOptions;
}

but how do i preselect a year??


Messages In This Thread
How to preselect a year already set in DB? - by El Forum - 02-16-2010, 02:49 PM
How to preselect a year already set in DB? - by El Forum - 02-16-2010, 03:42 PM
How to preselect a year already set in DB? - by El Forum - 02-16-2010, 03:44 PM
How to preselect a year already set in DB? - by El Forum - 02-16-2010, 04:02 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.