CodeIgniter Forums
Not a repost, but still can't solve: form_radio+set_radio - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Not a repost, but still can't solve: form_radio+set_radio (/showthread.php?tid=51703)



Not a repost, but still can't solve: form_radio+set_radio - El Forum - 05-14-2012

[eluser]it.peds[/eluser]
Here is so far I get after searching this forum,
Code:
<?=form_radio(array('name'=>'myRadios','id'=>'dynamic'.$option->id,'value'='dynamic'.$option->value,'checked'=>set_radio('myRadios','dynamic'.$option->value,($selected == 'dynamic'.$option->value))))?>
Business case is to record which one of a random number of people selected something. I use foreach to generate the form_radio and other inputs for each person. I certain the database saved whoever selected, but the cannot repopulate the 'checked' attribute at all. I would like to be able to repopulate from both database and invalid_update(ie, fail form_validation, but still shows user last input unless it's empty). the output in the browser is,
Code:
<input type="radio" name="myRadio" id="dynamic#1" value="dynamic+value" />