gdform.php and checkbox group
bassguy said 1 year ago:
Hello, Ive tried several different examples that I’ve found on the web but I’m not getting the expected results. I’m trying to set up a checkbox group. The purpose it to be able to “check all that apply” where you can select anywhere from 1 checkbox to all 4. The way it is now, only the last box checked is showing up on my gdform.php response email. Can someone show me the proper code for this that will work with gdform.php? Thanks in advance for your help.
sherrod said 1 year ago:
@bassguy,
For ideas on how to script this you may wish to visit http://w3schools.com. However please reply with the link to the form you are working with so may review exactly you are working on.
Sherrod
bassguy said 1 year ago:
Sherrod,
Thanks for your reply.
The code that I’m using now is from http://w3schools.com.
Here’s what I’m using for code:
<input type=”checkbox” name=”sizes” value=”Youth” /> Youth
<input type=”checkbox” name=”sizes” value=”S-XL” /> S-XL
<input type=”checkbox” name=”sizes” value=”2X-3X” /> 2X-3X
<input type=”checkbox” name=”sizes” value=”4X-5X” /> 4X-5X
And here’s my whole form:
http://www.advantageprintwear.com/quote.html
Everything else works fine except for the checkboxes. Only the last selected check box shows up in the email.
bassguy said 1 year ago:
I have setup a simple test page. It contains the gdform.php form mailer sample, directly from your web page
http://support.godaddy.com/help/510/using-php-form-mailers#webformmailer
plus an additional 2 lines of sample checkbox code from http://www.w3schools.com/html/html_forms.asp
<input type=”checkbox” name=”vehicle” value=”Bike” /> I have a bike
<input type=”checkbox” name=”vehicle” value=”Car” /> I have a car
Here is the URL of my test page:
http://www.advantageprintwear.com/form.html
Here is the complete HTML of my test page:
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html><head>
<meta content=”text/html; charset=ISO-8859-1″ http-equiv=”Content-Type”>
<title>Test</title></head><body>
<form action=”/gdform.php” method=”post”>
<input name=”subject” value=”Form Submission” type=”hidden”>
<input name=”redirect” value=”thankyou.html” type=”hidden”>
<p>First Name:<input name=”FirstName” type=”text”></p>
<p>Last Name:<input name=”LastName” type=”text”></p>
<p>E-Mail:<input name=”email” type=”text”></p>
<input name=”vehicle” value=”Bike” type=”checkbox”> I have a bike
<input name=”vehicle” value=”Car” type=”checkbox”> I have a car
<p>Comments:<textarea name=”comments” cols=”40″ rows=”10″>Type comments here.</textarea></p>
<input name=”submit” value=”submit” type=”submit”>
</form>
</body></html>
If you check both boxes, only the last checked box shows up in the response email. I have ran several tests. I checked both boxes each time. Here is the response email I received:
FirstName: Testy
LastName: McTester
comments: Type comments here. here are my comments!
email: testy@aol.com
submit: submit
vehicle: Car
—————————————————————–
This e-mail was generated from a form submission on your website:
advantageprintwear.com
I’m thinking this is a problem with the php on your end. It has been 3 days since my original post. Could someone respond to this issue, please?
timb said 1 year ago:
@bassguy
It looks like you are using the same input name for your check box field within your code which is the cause of the issue you are describing (input name=”vehicle”). If you change this variable it should send you the results correctly.
Tim B
bassguy said 1 year ago:
Thank you Tim. That fixed it.
0 min expected wait time