I have several like this in my HTML code:
<input class="table" type="checkbox" name="interest[]" value="finger food" />
and this in my PHP code:
$checkboxes = stripslashes($_POST['interest']);
//process the checkboxes
foreach ($checkboxes as $value) {
$selectedChkbx .= $value . ", ";
}
I am getting:
Warning: Invalid argument supplied for foreach()foreach()
and my $selectedChkbx variable isn’t getting any values inside of it. Does anyone know what I’m doing wrong?
stripslashes($_POST[‘interest’]);
stripslashes doesn’t work on arrays!
Do it like this:
Answer to your comment:
This gives you:
Edit
Replaced personal recursive function with a more elegant one 😉