Welcome Guest, Not a member yet? Register   Sign In
Validation and Checkbox
#1

[eluser]Yash[/eluser]
Hi,

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.
Code:
if(!isset($_POST['start']))
  {
      
if($generalsettings['ShowRecentComments']==1)
        $ShowRecentComments=$this->validation->set_checkbox('ShowRecentComments', '1');
    else
        $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?




Theme © iAndrew 2016 - Forum software by © MyBB