Code: Select all
<form action="index.php" method="post">
<p>
<input type="checkbox" name="food[]" value="Piza" /><br />
<input type="checkbox" name="food[]" value="Steak" /><br />
<input type="checkbox" name="food[]" value="Chips" /><br />
<input type="checkbox" name="food[]" value="Pasta" /><br />
<input type="submit" name="Submit" value="Submit" />
</p>
</form>If you submit the form without checking any then PHP will not put the element in the POST array, so it would look like:
Code: Select all
Array (
[submit] => Submit
)Code: Select all
Array (
[submit] => Submit,
[food] =>
)Thanks.