![Picture of Albert Padley Picture of Albert Padley](/graphics/unknown.gif)
Albert Padley - 2006-12-29 21:43:27
I need to create a long list of years in a Select. I really don't wan't to have to do this by hand. I have tried the following, but keep getting an invalid options array error.
$my_date=date("Y");
$first_year = $my_date-3;
$yearEnd=$my_date;
$inter_date = "array(";
//$inter .= "\"\"=>\"--\",";
for($year=$first_year; $year <= $yearEnd; $year++) {
$inter_date .= "\"$year\"=>\"$year\",";
}
$inter_date .= ")";
The above appears to create the array. Then I do the following:
$accident->AddInput(array(
"TYPE"=>"select",
"NAME"=>"year",
"ID"=>"year",
"VALUE"=>"2003",
"SELECTED"=>"2003",
"SIZE"=>1,
"OPTIONS"=>$inter_date,
));
What am I doing wrong or how can this be done in another way?
Thanks.