i am posting an array of checkboxes. and i cant get it to work. i didnt include the proper syntax in the foreach loop to keep it simple. but it is working. i tested in by trying to do the same thing with a text field instead of a checkbox and it worked with the textfield.
<?php
<form method="post">
echo'
foreach{
<input id="'.$userid.'" value="'.$userid.'" name="invite[]" type="checkbox">
<input type="submit">';
}
</form>
?>
here is the part that is not working. it is echoing 'invite' instead of array.
<?php
if(isset($_POST['invite'])){
$invite = $_POST['invite'];
echo $invite;
}
$invite
is an array. Tryprint_r($invite);
instead ofecho
– Tom Pietrosanti May 18 '12 at 15:22print_r($_POST);
and see what is actually set. – Nick May 18 '12 at 15:24foreach
shouldn't be inside yourecho
and your HTML is inside of you<?PHP ?>
tags. – Tom Pietrosanti May 18 '12 at 15:40