ericlbarnes / Statamic-email-form

Email form plugin for Statamic
http://ericlbarnes.com/blog/statamic-email-form-plugin
Other
36 stars 6 forks source link

Checkbox Submission #16

Closed garethredfern closed 3 years ago

garethredfern commented 11 years ago

Hi Eric, would it be possible to add in checkbox submission? I have had a play round with the code but have come to a bit of a dead end. I am guessing there needs to be some kind of for each loop adding so that all the items from the checkbox array get posted?

ericlbarnes commented 11 years ago

Can you show me how you want to set up the checkboxes? Is the name an array?

<input type="checkbox" name="foo[]" value="bar">
garethredfern commented 11 years ago

Hi Eric, yes sure, i am wanting to do as you describe above my form code is:

<div class="checkboxes">
<label><input type="checkbox" name="checkboxes[]" class="checkbox" value="Google Apps"> Google Apps   Business Email</label>
<label><input type="checkbox" name="checkboxes[]" class="checkbox" value="Google Analytics"> Extended Google Analytics Support</label>
</div>

There will be more checkboxes added in time so I would like the ability to have as many checkboxes as I like. If I use the form with this code it just posts the word "Array" at the moment.

ericlbarnes commented 11 years ago

Can you try that pi.email_form.php that I committed above in the post-arrays branch. I think that should get you fixed up.

garethredfern commented 11 years ago

Hi Eric, I gave the post-arrays branch a try and I am still getting the following posted in the message instead of the checkbox names and vales:

checkboxes: Array

ericlbarnes commented 11 years ago

Okay, I will do some further testing.

-- Eric