CodeIgniter Forums
CI 1.7 form_checkbox() bug [FIX] - 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: CI 1.7 form_checkbox() bug [FIX] (/showthread.php?tid=12738)



CI 1.7 form_checkbox() bug [FIX] - El Forum - 10-29-2008

[eluser]dmiden[/eluser]
Hey,
I noticed that when I used form_checkbox() it always returned NULL.
The problem lies within the form helper, use my fix:
line 300 - system/helpers/form_helper.php:
Code:
$defaults = array('type' => 'checkbox', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value);
to
Code:
$defaults = array('type' => 'checkbox', 'name' => (( ! is_array($data)) ? $data : ''));

Smile