[eluser]gigas10[/eluser]
I'm having a hard time trying to figure out how to repopulate a select multiple form field if I find errors and I'm redirected back to the page with the form. How exactly do I grab all the values that were in the select field? I know once I recieve the post data, I can just foreach through it, but it seems that codeigniter does not work like this for post back data. Any help is much appreciated and this is my current code:
Code:
<select id='root_cause' name='root_cause' multiple="multiple">
<?php
foreach($root_causes AS $rc) {
?><option value="<?=$rc->id;?>"
<?php if(validation_errors()) {
foreach(set_value('root_cause') AS $id) {
if(set_value('root_cause') == $rc->id) {
echo " SELECTED";
}
}
} ?>><?=$rc->cause;?></option><?php
}
?>
</select>
Yes I did post something similar to this before, but my problem was never solved, just completely sidetracked.