I am having trouble with form validation for checkboxes.
Here is the checkbox code:
<div class="form-group">
<div class="checkbox checkbox-danger checkbox-inline">
<input type="checkbox" name="defect[]" value="{$ng_id}">
</div>
</div>
If I just do something like this then it echo's out whatever I select.
foreach($_POST['defect'] as $defects) {
echo $defects;
}
I have tried to use the empty function on its own as well as this:
if(empty($defects) || count($defects) < 1) {
but I just keep getting the error:
Undefined index: defect