[eluser]squarebones[/eluser]
This is what I used to check the status of a checkbox submitted from a form. Be sure to include the name of the checkbox input in your form validation (though in my case I won't ever save/set the status of the checkbox in the form because it uses it to perform a specific function) if you are using that feature of your form (just FYI).
Code:
$photocb = $this->input->post('photocb'); # name of my checkbox field
if(isset($photocb) && $photocb !== FALSE){ # FALSE if no checkbox is checked...redundant, but safe
foreach($photocb as $value){ # checks the status of multiple checkboxes, so can be removed
$this->model->update_f('table_id',$value); # or however you update your table
}
}
NOTE: The if statement checks are probably redundant, but better safe than...
This is how the checkbox(es) field(s) is/are setup in the form:
Code:
form_checkbox('photocb[]','photo0');
[form_checkbox('photocb[]',photo1');
# etc.