Why isn't set_checkbox working for me? - 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: Why isn't set_checkbox working for me? (/showthread.php?tid=49548) |
Why isn't set_checkbox working for me? - El Forum - 02-24-2012 [eluser]Unknown[/eluser] Hi everyone, I'll admit up-front that I'm very new to CodeIgniter. I'm creating a set of checkboxes in my PyroCMS admin page using CodeIgniter's form_checkbox and set_checkbox functions: Code: <?php echo form_checkbox('purpose_e', '1', set_checkbox('purpose_e', '1')); ?> Environmental Everything seems to work fine, the page executes and the relevant 1 values are written to the database fields, but when I edit the entry the relevant checkboxes aren't being rechecked, I just get a set of blank unchecked boxes. Is there some elementary mistake I'm making? Thanks in advance for any help, Tony. Why isn't set_checkbox working for me? - El Forum - 02-24-2012 [eluser]CroNiX[/eluser] Yes, set_checkbox() is only for if you are manually writing the html checkbox form element. You are using the form helper to generate your checkboxes. Try using set_value(). The 2nd value for the default should be a boolean, like TRUE/FALSE, not a string like '1'. Why isn't set_checkbox working for me? - El Forum - 02-27-2012 [eluser]Aken[/eluser] I touched on this a while back, maybe it will help you: http://ellislab.com/forums/viewthread/194556/ |