Just a tiny helper to help with checkboxes. When you uncheck a checkbox, it's value does not get sent in the form values. Instead of telling CodeIgniter you want to set this value to 0, it says "don't change it." This fixes that, one by one, by setting the value of the associated $_POST array item to zero. You can also pass in an array of checkbox names and it will do each one.
$this->load->helper('checkbox');
// set post values to zero for unchecked boxes
fix_unchecked(['is_active', 'is_enabled', 'is_verified']);
Hi!!
Nice and useful snippet, I have modified it to use $CI instead of $this, and also check if there has been a POST request.
https://gist.github.com/pporlan/8316087