I have a checkbox group which works fine when you tick one but it returns an error if all are left unticked.
Here’s the code:
foreach ($_SESSION['CheckboxGroup1'] as $val) {
$checkbox1results .= $val.",\n";
}
This is the error I’m getting back:
Warning: Invalid argument supplied for foreach() in
/home/medicom/public_html/memberappform1.php on line 492
I’m not great with php so need a way to return nothing in the loop if nothing is ticked.
1 Answer