PHP Code:
if($item){ //Run only when submit the form
if ($item == NULL) {
This will never work. If you haven't selected any checkbox, $item will be empty, so the line with "if ($item == NULL) {" will not be executed.
I assume that your form has a submit button, probably with the name "submit".
PHP Code:
$submit = $this->input->post('submit');
if ($submit) {
$items = $this->input->post('service');
if (! empty($items)) {
foreach($items as $item) {
//process the checkboxes that where checked
}
}
else {
// redirect
}
}