error handling check boxes in a form

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
packetsmacker
Forum Newbie
Posts: 5
Joined: Mon Oct 15, 2007 12:05 pm

error handling check boxes in a form

Post by packetsmacker »

How do I make sure at lest one of my check boxes is check? Below is my form code.


<form action="menugen.php" method="post">
<table border="1">
<tr>
<td>Food:</td>
<td><input type="text" name="food" /></td>
</tr>
<td>Breakfast:</td>
<td align="center"><input type="checkbox" name="MealTime[]" value="Breakfast" /></td>
<tr>
<td>Lunch:</td>
<td align="center"><input type="checkbox" name="MealTime[]" value="Lunch" /></td>
</tr>
<tr>
<td>Dinner:</td>
<td align="center"><input type="checkbox" name="MealTime[]" value="Dinner" /></td>
</tr>
</table>
<input type="submit" name="Submit" value="Submit" />
</form>
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

Re: error handling check boxes in a form

Post by susrisha »

Post Reply