I'm getting the same error, but it is happening because a particular checkbox is being left empty. I have 6 different checkbox fieldsets for types of lodging, and the user will likely only choose one.
How can I keep my form from throwing the error if a checkbox is left blank? I don't need this item to be required, this is just the way it will be filled out sometimes.
The code looks like this in the email template:
<tr><td><p><strong>Type B:</strong> <?php
foreach ( $_POST['choose_b'] as $choose_b ) {
echo "$choose_b, ";
}
?></p></td></tr>
<tr><td><p><strong>Type C:</strong> <?php
foreach ( $_POST['choose_c'] as $choose_c ) {
echo "$choose_c, ";
}
?></p></td></tr>
and like this in the form:
<tr><td><p><strong>Type B:</strong> (<input type="checkbox" name="choose_b[0]"
value="Choose Type B"
<?php
if($_POST['choose_b'][0] == 'choose type b')echo' checked ';
?> />
Choose this option or check one)<br> <em>
<input type="checkbox" name="choose_b[1]" value="Blue Wing"
<?php
if($_POST['choose_b'][1] == 'blue wing')echo' checked ';
?>
/>Blue Wing,
<input type="checkbox" name="choose_b[2]" value="Green Wing"
<?php
if($_POST['choose_b'][2] == 'green wing')echo' checked ';
?>
/> Green Wing</em><br />
One-bedroom Apartment Suites. Located on the lowest level of the larger Manager's home and winter
office, these two suites have a living room (which has a double sofa bed) with fireplace, a full sized kitchen and a separate bath. Each has a walkout patio deck. Elevated a little from the lakefront and setback 124 ft from the lakefront, these suites have lovely long views of the lake and its gorgeous islands. The two suites can also be rented together as a two-bedroom duplex. The suites work well for people traveling alone, who do not want to be in an individual cabin alone. They also are a more economic option for couples or small families who want a full kitchen and fireplace.</p></td></tr>
<tr><td><p><strong>Type C:</strong> (<input type="checkbox" name="choose_c[0]" value="Choose Type C" <?php if($_POST['choose_c'][0] == 'choose type c')echo' checked '; ?> /> Choose this option or check one)<br>
<input type="checkbox" name="choose_c[1]" value="Balsam" <?php if($_POST['choose_c'][1] == 'balsam')echo' checked '; ?> />Balsam, <input type="checkbox" name="choose_c[2]" value="Hemlock" <?php if($_POST['choose_c'][2] == 'hemlock')echo' checked '; ?> /> Hemlock, <input type="checkbox" name="choose_c[3]" value="Alder" <?php if($_POST['choose_c'][3] == 'alder')echo' checked '; ?> /> Alder and <input type="checkbox" name="choose_c[4]" value="Yellow Birch" <?php if($_POST['choose_c'][4] == 'yellow birch')echo' checked '; ?> /> Yellow Birch</em>
<br>
All Type C units are individual log cabins along the quiet lakeshore of Teal Lake; with full kitchens and wood burning fireplaces. The full kitchens come with gas stoves, full refrigerator, pots and pans, utensils, plates, glasses, etc. Everything you should need to make a snack or a full meal. (if you need a bigger pot, come ask at the restaurant kitchen, we have a few to spare!). However each Type C has unique qualities, atmospheres, and layout. Only one has a screen porch, but all have comfortable seating outside with lovely lake views. Some have bigger living rooms while others have larger bedrooms.</p></td></tr>
Thanks!
Vicky Rowe
Edited to break up long line<br><br>Post edited by: GreyHead, at: 2008/03/15 16:11