Ghamdan Posted October 5, 2012 Share Posted October 5, 2012 I am trying to create a form with check boxes so the data will be sent by email. When two boxes are checked, only one value is passed. Can you show me how to get and validate check boxes data so I can use a booking form on the website? Thank you Link to comment Share on other sites More sharing options...
Dan Posted October 5, 2012 Share Posted October 5, 2012 I googled your question and the first site that came back was this. http://www.html-form-guide.com/php-form/php-form-checkbox.html Google is a developer's best friend. Dan 1 Link to comment Share on other sites More sharing options...
rob Posted October 6, 2012 Share Posted October 6, 2012 When two boxes are checked, only one value is passed. You need to show us your code. Link to comment Share on other sites More sharing options...
Ghamdan Posted October 6, 2012 Author Share Posted October 6, 2012 // Process checkbox: if(isset($scrubbed['service'])) { $service = $scrubbed['service']; } else { $service = NULL; $errors[] = "<p class=\"errors\">Please check some of the boxes. </p>"; } <fieldset class="checkbox"> <p>Service type: </p> <ul> <li> <input type="checkbox" name="service" id="service-one" value="one" /> <label for="service-one"> service-one </label> </li> <li> <input type="checkbox" name="service" id="service-two" value="two" /> <label for="service-two">service-two </label> </li> <li> <input type="checkbox" name="service" id="service-three" value="three" /> <label for="ervice-three"> service-three</label> </li> <li> <input type="checkbox" name="service" id="other-service" value="other-service" /> <label for="other-service"> Other </label> </li> </ul> </fieldset> Link to comment Share on other sites More sharing options...
margaux Posted October 7, 2012 Share Posted October 7, 2012 You'll need to show more code that processes the form once its submitted. Link to comment Share on other sites More sharing options...
Recommended Posts