I have a set of checkboxes which when checked they pass the value as 1, otherwise they pass the value as 0. However, instead of sending the value of the unchecked checkboxe
You can try this , it may help you. Assume your form is like this:
Active
active),TRUE); ?>
Now you set your codeigniter controller like this:
// Set up the form
$rules = $this->student_m->rules;
$this->form_validation->set_rules($rules);
// Process the form
if ($this->form_validation->run() == TRUE) {
$data = $this->student_m->array_from_post(array(
'active',
'name'
));
// checking is checkbox is checked or not
($data['active'] == TRUE)?($data['active'] = 1) : ($data['active'] = 0);
$this->student_m->save($data, $id);
redirect('admin/student');
}