I have a htnl form and code to process it
the form includes checkboxes
everything works fine if the user does select at least one of the checkboxes, but if the form is submitted without any checkboxes being ticked I get
Warning: Invalid argument supplied for foreach()
I need to be able to process the form and allow the user the option to ignore one complete set of check boxes if they so desire - how do I do this?
my code for the form is
<INPUT TYPE="CHECKBOX" NAME="Information[]" VALUE="Shipped" >
Notify me when shipped<br>
<INPUT TYPE="CHECKBOX" NAME="Information[]" VALUE="Built" >
Notify me when it is built<br>
<INPUT TYPE="CHECKBOX" NAME="Information[]" VALUE="Ordered" >
Notify me when the parts are on order<br>
my code to process the form is
// amongst other radio buttons and text fields
$when = $_POST['Information'];
foreach($when as $w)
{
$info .= $w.' ';
}
$body = " blah blah blah";
mail ("info@ccc.co.uk", "Feedback From Website", "$body", "FROM:website@ccc.co.uk");