[eluser]stef25[/eluser]
im using egoslip's function as a helper after modifying the buildYearDropdown function slightly:
Code:
function buildYearDropdown($name='',$value='')
{
$years = range(1900, date("Y"));
foreach($years as $year)
{
$year_list[$year] = $year;
}
return form_dropdown($name, $year_list, $value);
}
called from controller with the 2nd parameter being the value that should be preselected in the drop down:
Code:
$data['dob_dropdown_year'] = buildYearDropdown('year', $data['old_profile_data']['year']);
and then printed out in the view via
Code:
<?= $dob_dropdown_year ?>
this generates a select field with name='year' and listing all years starting from 1900 till the current year and the values of the options are correct.
hope this helps some one!