Jump to content
Larry Ullman's Book Forums

How To Get And Validate Data From Check Boxes?

Recommended Posts

// 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>



<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>



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...