Development Blog

January 25, 2013
Get values from multiple checkboxes with PHP sendmail.
HTML
PHP



We normally create a unquie name for each checkboxes (ie Color_Checkbox_1, Color_Checkbox_2, Color_Checkbox_3) but we can collect all this with a single name value. Add the open-closed square brackets to the end of the value name and it will get all the checked items.

RAW
<style type="text/css">

<input name="Colors[]" value="Red" type="checkbox"> Red<br />
<input name="Colors[]" value="White" type="checkbox"> White<br />
<input name="Colors[]" value="Blue" type="checkbox"> Blue<br />

<input name="Email_Subject" type="hidden" value="Picking Colors">
<input name="report" type="hidden" value="Email_Subject,Colors">



Let's say I have checked all items and the email I received or the data we're collecting will look something like this:


RESULT
Email Subject: Picking Colors
Colors: Red, White, Blue


Also check out my blog on preserve select multiple answers with jQuery on PHP $_Post.
Home | Portfolio | Expertise | Clients | People | Contact | Privacy Policy | Copyright Policy
Copyright © 2024 Pinpoint Design LLC. All Rights Reserved.