Mous86 Posted September 16, 2009 Share Posted September 16, 2009 I've been trying to capture the values of the checkboxes in my form. so far I've only been able to get the last checkbox value checked sent. I have also tried using isset, putting the grouped checkboxes in to an array or giving them indivdual names. Furthermore I've tried the following for the checkboxes and end up getting a parsing error. won't go past the first if statement. _________________________________________________________________________ HTML CODE _________________________________________________________________________ <!-- form --> <div id="form"> <form onsubmit="return submitIt(this)" method="post" enctype="multipart/form-data" action="test.php" name="enquiry" class="form" > <label class="profile">Suitable Contact Times: <span class="required">*</span></label> <!-- f-right --> <div id="f-right"> <input type="checkbox" name="timem" class="check" id="morning" value="9 00am to 12noon Mornings" /> <label for="morning" id="timem">9.00am to 12noon Mornings</label> <br /> <input type="checkbox" name="timea" class="check" id="afternoon" value="12 00pm to 5 00pm Afternoons" /> <label for="afternoon" id="timea">12.00pm to 5.00pm Afternoons</label> <br /> <input type="checkbox" name="timee" class="check" id="evening" value="5 00pm to 9 00pm Evenings" /> <label for="evening" id="timee">5.00pm to 9.00pm Evenings</label> <br /> <input type="checkbox" name="timen" class="check" id="night" value="9 00pm to 11 00pm Nights" /> <label for="night" id="timen">9.00pm to 11.00pm Nights</label> <!-- end f-right --> </div> <!-- button1 --> <div id="button"> <input type="submit" value="Submit" class="button1" size="3" /> <input type="reset" value="Clear Form" class="button2" size="3" /> <!-- end button --> </div> <!-- end form --> </div> _________________________________________________________________________ PHP CODE _________________________________________________________________________ <?php $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/")); mail("Email address","Subject","Form data: if (isset($_POST['timem'])) { Suitable Contact Time: " . $_POST['timem'] . " } if (isset($_POST['timea'])) { Suitable Contact Time: " . $_POST['timea'] . " } if (isset($_POST['timee'])) { Suitable Contact Time: " . $_POST['timee'] . " } if (isset($_POST['timen'])) { Suitable Contact Time: " . $_POST['timen'] . " } if (isset($_POST['timem'])) && (isset($_POST['timea'])) { Suitable Contact Times: " . $_POST['timem'] . " " . $_POST['timea'] . " } "); include("thankyou.html"); ?> _________________________________________________________________________ Thanks Link to comment https://forums.phpfreaks.com/topic/174427-form-checkboxes/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.