[eluser]Unknown[/eluser]
Hello,
Maybe I'm doing this incorrectly by CI(MVC) standards (100% most likely the case), but I've got a function put inside of a helper.
Code:
function date_dropdown()
{
/* Months */
$form_output = '<select name="release_month" id="release_month">';
$months = array('','January','Febuary','March','April','May','June','July','August','September','October','Novemeber','December');
for ( $month = 1; $month <= 12; $month++)
{
$form_output .= '<option value="' . $month .'">' . $months[$month] . '</option>';
}
$form_output .= '</select>';
/* Days */
$form_output .= '<select name="release_day" id="release_day">';
for ( $day = 1; $day <= 31; $day++ )
{
$form_output .= '<option value="' . $day . '">'. $day .'</option>';
}
$form_output .= '</select>';
/* Years */
$form_output .= '<select name="release_year" id="release_year">';
for ( $year = 1952; $year <= ( date("Y") ); $year++ )
{
$form_output .= '<option value="' . $year . '">' . $year . '</option>';
}
$form_output .= '</select>';
return $form_output;
}
Now, I'm calling this in my view to create a date dropdown list. The list itself works flawlessly, but my problem is trying to get it to be able to re-populate on form error.
I can't put the set_select('name','value') snippet into that code - so exactly how would one go through with ensuring these fields are repopulated? I've been playing around with this for about 2 hours now.
--edit;
I guess while I'm here, I'm also having issues repopulating multiple selects. Only the last selection is saved.
Thanks.