If I have a checkbox on the contact form how do I pull these values into the email template.

My form looks like

    <label for="telephone">Contact Method</label>
    <div class="input-box">
       <input type="checkbox" name="contact_method[]" value="Telephone"> Telephone<br>
       <input type="checkbox" name="contact_method[]" value="Email"> Email<br>

However if I do

Contact Method: {{var data.contact_method}}

The value comes out as array

  • Did you try changing the name to contact_method instead of contact_method[] ? – Raphael at Digital Pianism Feb 22 '16 at 13:15
  • Yes I tried {{var data.contact_method[]}} and {{var data.contact_method[0]}} but both come out blank – Goose84 Feb 22 '16 at 13:18
  • In your form "<input type="checkbox" name="contact_method[]" value="Telephone"> Telephone<br>" remove the [] from contact_method – Klettseb Feb 22 '16 at 13:19
  • If I remove the [] then only 1 option can be selected – Goose84 Feb 22 '16 at 13:20
  • I didn't notice you were using checkboxes. You should not be using the same name in case of checkboxes, try using two different names and then use 2 lines in your email template. – Raphael at Digital Pianism Feb 22 '16 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.