CodeIgniter Forums
Validation and Checkbox - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Validation and Checkbox (/showthread.php?tid=10156)

Validation and Checkbox - El Forum - 07-21-2008


I need to store some initial value in checkbox. And I need to validate all fields.I'm using a hidden variable so that if it is not set I'll store initial value.Then after form submission it should maintain values and submit form if no error found.
        $ShowRecentComments=$this->validation->set_checkbox('ShowRecentComments', '1');
        $ShowRecentComments=$this->validation->set_checkbox('ShowRecentComments', '0');

<input type="checkbox" name="ShowRecentComments" id="ShowRecentComments" <?=$ShowRecentComments?>/>

but this code is not working.

I have set fields in controller.
Any idea?