Help - Search - Members - Calendar
Full Version: form not working
HTMLHelp Forums > Web Authoring > Web Site Functionality
nater
Hi, I'm new to html and php and am trying to help a client with their form on a wordpress page.
the error we are getting is "Error: Bad/No Recipient
There was no recipient or an invalid recipient specified in the data sent to FormMail. Please make sure you have filled in the recipient form field with an e-mail address that has been configured in @recipients."

Here is the code. This is linked to a form.pl file in the cgi.bin folder

CODE
<script type="text/javascript"><!--
function checkCheckbox (f,name,require) {
var checked = 0, e, i = 0
while (e = f.elements[i++]) {if (e.type == 'checkbox' && e.name == name && e.checked) checked++}
if (checked < require) {
alert(name + " error");
}
return require <= checked

}

function check (f) {
return checkCheckbox (f,"What would you like to do?",1)
return checkCheckbox (f,"Tell us a little bit about yourself",1)
return checkCheckbox (f,"How did you hear about us",1)
}
// --></script>
<strong>Complete the form below to redeem your free downloadable Health Tips or Request an Initial Delicious Health Consultation with Simla.</strong>

<strong><span style="font-weight: normal;">You may also call us directly at 415.595.5775 between 9am – 5pm PST. If you request an initial consultation, we’ll contact you as soon as we can to schedule your session. Fields marked with a ‘*’ are required. Your information is kept private and will never be shared with any third parties.</span></strong>

<form action="http://www.enjoydelicioushealth.com/cgi-bin/FormMail.pl" method="POST">
<table border="0" cellspacing="3" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="padding-top:15px;" colspan="2"><strong>Your Contact Information</strong></td>
</tr>
<tr>
<td width="150" valign="top">*Your Full Name</td>
<td style="padding-left: 5px;" valign="top"><input maxlength="50" name="realname" size="30" type="text" /></td>
</tr>
<tr>
<td valign="top">*Email Address</td>
<td style="padding-left: 5px;" valign="top"><input maxlength="100" name="email" size="30" type="text" /></td>
</tr>
<tr>
<td valign="top">*Phone Number</td>
<td style="padding-left: 5px;" valign="top"><input maxlength="20" name="phone" size="30" type="text" /></td>
</tr>
<tr>
<td valign="top">Company</td>
<td style="padding-left: 5px;" valign="top"><input maxlength="50" name="company" size="30" type="text" /></td>
</tr>
<tr>
<td valign="top">Mailing Address</td>
<td style="padding-left: 5px;" valign="top"><input maxlength="50" name="mail1" size="30" type="text" /></td>
</tr>
<tr>
<td valign="top">Mailing Address (cont)</td>
<td style="padding-left: 5px;" valign="top"><input maxlength="50" name="mail2" size="30" type="text" /></td>
</tr>
<tr>
<td valign="top">City</td>
<td style="padding-left: 5px;" valign="top"><input maxlength="100" name="city" size="20" type="text" /></td>
</tr>
<tr>
<td valign="top">State or Province</td>
<td style="padding-left: 5px;" valign="top"><input maxlength="2" name="state" size="2" type="text" /></td>
</tr>
<tr>
<td valign="top">Zip Code</td>
<td style="padding-left: 5px;" valign="top"><input maxlength="11" name="zip" size="11" type="text" /></td>
</tr>
<tr>
<td valign="top">Country</td>
<td style="padding-left: 5px;" valign="top"><input maxlength="11" name="country" size="11" type="text" /></td>
</tr>
</tbody></table>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td colspan="2"><fieldset><legend><strong>*What would you like to do? Check all that apply.</strong></legend></fieldset></td>
</tr>
<tr>
<td width="5%" align="left" valign="top"><input id="What would you like to do?" name="What would you like to do?" type="checkbox" value="Sign up for a free Delicious Health Consultation" /></td>
<td width="95%" align="left" valign="top">Sign up for a <strong>free Delicious Health Consultation</strong></td>
</tr>
<tr>
<td align="left" valign="top"><input id="What would you like to do?" name="What would you like to do?" type="checkbox" value="Download the free report 17 Delicious Health Tips That Can Change Your Life" /></td>
<td align="left" valign="top">Download the free report <em><strong>17 Delicious Health Tips That Can Change Your Life</strong></em></td>
</tr>
<tr>
<td align="left" valign="top"><input id="What would you like to do?" name="What would you like to do?" type="checkbox" value="Sign up for News Bite – Delicious Health’s free monthly online newsletter full of nutrition information & inspiration" /></td>
<td align="left" valign="top">Sign up for <strong><em>News Bite</em> – Delicious Health’s free monthly online newsletter full of nutrition information & inspiration</strong></td>
</tr>
<tr>
<td style="padding-top:15px;" colspan="2" align="left" valign="top"><fieldset><legend><strong>*Tell us a little bit about yourself so we can better respond to your inquiry. Check all that apply.</strong></legend></fieldset></td>
</tr>
<tr>
<td align="left" valign="top"><input id="Tell us a little bit about yourself" name="Tell us a little bit about yourself" type="checkbox" value="I’m feeling “off” and want to take better care of myself to feel more balanced, energized, and healthy." /></td>
<td align="left" valign="top">I’m feeling “off” and want to take better care of myself to feel more balanced, energized, and healthy.<strong></strong></td>
</tr>
<tr>
<td valign="top"><input id="Tell us a little bit about yourself" name="Tell us a little bit about yourself" type="checkbox" value="I’ve been diagnosed with a chronic condition and want to take better care of myself through nutrition and lifestyle choices." /></td>
<td align="left" valign="top">I’ve been diagnosed with a chronic condition and want to take better care of myself through nutrition and lifestyle choices.</td>
</tr>
<tr>
<td align="left" valign="top"><input id="Tell us a little bit about yourself" name="Tell us a little bit about yourself" type="checkbox" value="I’m interested in your services on behalf of my organization." /></td>
<td align="left" valign="top">I’m interested in your services on behalf of my organization.</td>
</tr>
<tr>
<td align="left" valign="top"><input id="Tell us a little bit about yourself" name="Tell us a little bit about yourself" type="checkbox" value="None of the above apply to me, but I’m interested in speaking with you anyway." /></td>
<td align="left" valign="top">None of the above apply to me, but I’m interested in speaking with you anyway.</td>
</tr>
<tr>
<td style="padding-top:15px;" colspan="2" align="left" valign="top"><fieldset><legend><strong>*How did you hear about us and our work? Check all that apply.</strong></legend></fieldset></td>
</tr>
<tr>
<td align="left" valign="top"><input id="How did you hear about us" name="How did you hear about us" type="checkbox" value="Through a friend or acquaintance." /></td>
<td style="display: inline; width: 400px;" valign="top">Through a friend or acquaintance. Who can we thank?

<input id="How did you hear about us" maxlength="50" name="How did you hear about us" size="20" type="text" /></td>
</tr>
<tr>
<td align="left" valign="top"><input id="How did you hear about us" name="How did you hear about us" type="checkbox" value="Through your newsletter." /></td>
<td align="left" valign="top">Through your newsletter.</td>
</tr>
<tr>
<td align="left" valign="top"><input id="How did you hear about us" name="How did you hear about us" type="checkbox" value="Through your blog." /></td>
<td align="left" valign="top">Through your blog.</td>
</tr>
<tr>
<td align="left" valign="top"><input id="How did you hear about us" name="How did you hear about us" type="checkbox" value="Through my own web search." /></td>
<td align="left" valign="top">Through my own web search.</td>
</tr>
<tr>
<td align="left" valign="top"><input id="How did you hear about us" name="How did you hear about us" type="checkbox" value="Through another web site" /></td>
<td align="left" valign="top">Through another web site. Which one?

<input id="How did you hear about us" maxlength="50" name="How did you hear about us" size="20" type="text" /></td>
</tr>
<tr>
<td align="left" valign="top"><input id="How did you hear about us" name="How did you hear about us" type="checkbox" value="I met Simla at an event." /></td>
<td align="left" valign="top">I met Simla at an event.</td>
</tr>
<tr>
<td align="left" valign="top"><input id="How did you hear about us" name="How did you hear about us" type="checkbox" value="Some other way." /></td>
<td align="left" valign="top">Some other way. Please describe:

<input id="How did you hear about us" maxlength="50" name="How did you hear about us" size="20" type="text" /></td>
</tr>
</tbody></table>
</form> <form action="http://www.enjoydelicioushealth.com/cgi-bin/FormMail.pl" method="POST">
<table border="0" cellspacing="3" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="padding-top:15px;" colspan="2" valign="top"><strong>Is there anything else you’d like to share with us? A specific question, perhaps, or a little more about what brought you to us?</strong></td>
</tr>
<tr>
<td></td>
<td><textarea id="textarea" cols="45" rows="5" name="other information"></textarea></td>
</tr>
<tr>
<td valign="top"></td>
<td style="padding-left: 215px;padding-top:15px;" valign="top"><input style="padding:3px;background-color:#FFE040;text-transform:uppercase;font-size:10px;" type="submit" value="Submit" /> <input style="padding:3px;background-color:#FEF9D9;text-transform:uppercase;font-size:10px;" type="reset" value="Clear Form" /></td>
</tr>
</tbody></table>
</form>


Thanks for any help you can give.
Darin McGrew
First, you'll need to add a recipient field. Then, you'll need to edit the script so @recipients includes the address you listed in the recipient field.
nater
Like this?
CODE
<input type=hidden name="recipient" value="email@your.host.com">

nater
QUOTE(nater @ Jun 17 2009, 03:59 PM) *

Like this?
CODE
<input type=hidden name="recipient" value="email@your.host.com">



and where does it go? I tried putting it after method=POST but that didn't help.

nater
Here is the url of the form I am working on.

http://enjoydelicioushealth.com/?cat=24

Thanks again
Darin McGrew
Please see the FAQ entry How do I use forms?
nater
QUOTE(Darin McGrew @ Jun 17 2009, 04:28 PM) *

Please see the FAQ entry How do I use forms?




I'm still confused after reading the FAQ.

The form is looking to the FormMail.pl file and the @referers = ('enjoydelicioushealth.com','');

Is this supposed to be an email address?

And then where do i put the recipient field?


Darin McGrew
My guess is that @recipients needs to contain a list of email addresses, and that @referers needs to contain a list of domain names.

The recipient field is probably a hidden input field:
http://htmlhelp.com/reference/html40/forms/input.html

The instructions that came with your FormMail.pl program should explain what hidden fields it needs, and how to specify them.
nater
Thanks for your help Davin, I got the form to send & redirect correctly.

But now it appears that the form is only sending some of the information along with the email. What I believe caused these problems was my own fault. I had copied the contact info part of the form and moved it to the top of the form, it used to be at the bottom. I was using the view option (& not html view) on wordpress so I may have pasted over some code.

Here is the info we recieve.

From: <>
Date: Thu, Jun 18, 2009 at 8:51 AM
Subject: WWW Form Submission
To: hello@enjoydelicioushealth.com


Below is the result of your feedback form.  It was submitted by
 () on Thursday, June 18, 2009 at 10:51:34
---------------------------------------------------------------------------

other information: Testing form one more time for proper redirect.

---------------------------------------------------------------------------

Here is the code for the form. - thanks again for the help.

CODE
<script type="text/javascript"><!--
function checkCheckbox (f,name,require) {
var checked = 0, e, i = 0
while (e = f.elements[i++]) {if (e.type == 'checkbox' && e.name == name && e.checked) checked++}
if (checked < require) {
alert(name + " error");
}
return require <= checked

}

function check (f) {
return checkCheckbox (f,"What would you like to do?",1)
return checkCheckbox (f,"Tell us a little bit about yourself",1)
return checkCheckbox (f,"How did you hear about us",1)
}
// --></script>
<strong>Complete the form below to redeem your free downloadable Health Tips or Request an Initial Delicious Health Consultation with Simla.</strong>

<strong><span style="font-weight: normal;">You may also call us directly at 415.595.5775 between 9am – 5pm PST. If you request an initial consultation, we’ll contact you as soon as we can to schedule your session. Fields marked with a ‘*’ are required. Your information is kept private and will never be shared with any third parties.</span></strong>

<form action="http://www.enjoydelicioushealth.com/cgi-bin/FormMail.pl" method="POST"><input type=hidden name="recipient" value="simla@enjoydelicioushealth.com">
<table border="0" cellspacing="3" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="padding-top:15px;" colspan="2"><strong>Your Contact Information</strong></td>
</tr>
<tr>
<td width="150" valign="top">*Your Full Name</td>
<td style="padding-left: 5px;" valign="top"><input maxlength="50" name="realname" size="30" type="text" /></td>
</tr>
<tr>
<td valign="top">*Email Address</td>
<td style="padding-left: 5px;" valign="top"><input maxlength="100" name="email" size="30" type="text" /></td>
</tr>
<tr>
<td valign="top">*Phone Number</td>
<td style="padding-left: 5px;" valign="top"><input maxlength="20" name="phone" size="30" type="text" /></td>
</tr>
<tr>
<td valign="top">Company</td>
<td style="padding-left: 5px;" valign="top"><input maxlength="50" name="company" size="30" type="text" /></td>
</tr>
<tr>
<td valign="top">Mailing Address</td>
<td style="padding-left: 5px;" valign="top"><input maxlength="50" name="mail1" size="30" type="text" /></td>
</tr>
<tr>
<td valign="top">Mailing Address (cont)</td>
<td style="padding-left: 5px;" valign="top"><input maxlength="50" name="mail2" size="30" type="text" /></td>
</tr>
<tr>
<td valign="top">City</td>
<td style="padding-left: 5px;" valign="top"><input maxlength="100" name="city" size="20" type="text" /></td>
</tr>
<tr>
<td valign="top">State or Province</td>
<td style="padding-left: 5px;" valign="top"><input maxlength="2" name="state" size="2" type="text" /></td>
</tr>
<tr>
<td valign="top">Zip Code</td>
<td style="padding-left: 5px;" valign="top"><input maxlength="11" name="zip" size="11" type="text" /></td>
</tr>
<tr>
<td valign="top">Country</td>
<td style="padding-left: 5px;" valign="top"><input maxlength="11" name="country" size="11" type="text" /></td>
</tr>
</tbody></table>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td colspan="2"><fieldset><legend><strong>*What would you like to do? Check all that apply.</strong></legend></fieldset></td>
</tr>
<tr>
<td width="5%" align="left" valign="top"><input id="What would you like to do?" name="What would you like to do?" type="checkbox" value="Sign up for a free Delicious Health Consultation" /></td>
<td width="95%" align="left" valign="top">Sign up for a <strong>free Delicious Health Consultation</strong></td>
</tr>
<tr>
<td align="left" valign="top"><input id="What would you like to do?" name="What would you like to do?" type="checkbox" value="Download the free report 17 Delicious Health Tips That Can Change Your Life" /></td>
<td align="left" valign="top">Download the free report <em><strong>17 Delicious Health Tips That Can Change Your Life</strong></em></td>
</tr>
<tr>
<td align="left" valign="top"><input id="What would you like to do?" name="What would you like to do?" type="checkbox" value="Sign up for News Bite – Delicious Health’s free monthly online newsletter full of nutrition information &amp; inspiration" /></td>
<td align="left" valign="top">Sign up for <strong><em>News Bite</em> – Delicious Health’s free monthly online newsletter full of nutrition information &amp; inspiration</strong></td>
</tr>
<tr>
<td style="padding-top:15px;" colspan="2" align="left" valign="top"><fieldset><legend><strong>*Tell us a little bit about yourself so we can better respond to your inquiry. Check all that apply.</strong></legend></fieldset></td>
</tr>
<tr>
<td align="left" valign="top"><input id="Tell us a little bit about yourself" name="Tell us a little bit about yourself" type="checkbox" value="I’m feeling “off” and want to take better care of myself to feel more balanced, energized, and healthy." /></td>
<td align="left" valign="top">I’m feeling “off” and want to take better care of myself to feel more balanced, energized, and healthy.<strong></strong></td>
</tr>
<tr>
<td valign="top"><input id="Tell us a little bit about yourself" name="Tell us a little bit about yourself" type="checkbox" value="I’ve been diagnosed with a chronic condition and want to take better care of myself through nutrition and lifestyle choices." /></td>
<td align="left" valign="top">I’ve been diagnosed with a chronic condition and want to take better care of myself through nutrition and lifestyle choices.</td>
</tr>
<tr>
<td align="left" valign="top"><input id="Tell us a little bit about yourself" name="Tell us a little bit about yourself" type="checkbox" value="I’m interested in your services on behalf of my organization." /></td>
<td align="left" valign="top">I’m interested in your services on behalf of my organization.</td>
</tr>
<tr>
<td align="left" valign="top"><input id="Tell us a little bit about yourself" name="Tell us a little bit about yourself" type="checkbox" value="None of the above apply to me, but I’m interested in speaking with you anyway." /></td>
<td align="left" valign="top">None of the above apply to me, but I’m interested in speaking with you anyway.</td>
</tr>
<tr>
<td style="padding-top:15px;" colspan="2" align="left" valign="top"><fieldset><legend><strong>*How did you hear about us and our work? Check all that apply.</strong></legend></fieldset></td>
</tr>
<tr>
<td align="left" valign="top"><input id="How did you hear about us" name="How did you hear about us" type="checkbox" value="Through a friend or acquaintance." /></td>
<td style="display: inline; width: 400px;" valign="top">Through a friend or acquaintance. Who can we thank?

<input id="How did you hear about us" maxlength="50" name="How did you hear about us" size="20" type="text" /></td>
</tr>
<tr>
<td align="left" valign="top"><input id="How did you hear about us" name="How did you hear about us" type="checkbox" value="Through your newsletter." /></td>
<td align="left" valign="top">Through your newsletter.</td>
</tr>
<tr>
<td align="left" valign="top"><input id="How did you hear about us" name="How did you hear about us" type="checkbox" value="Through your blog." /></td>
<td align="left" valign="top">Through your blog.</td>
</tr>
<tr>
<td align="left" valign="top"><input id="How did you hear about us" name="How did you hear about us" type="checkbox" value="Through my own web search." /></td>
<td align="left" valign="top">Through my own web search.</td>
</tr>
<tr>
<td align="left" valign="top"><input id="How did you hear about us" name="How did you hear about us" type="checkbox" value="Through another web site" /></td>
<td align="left" valign="top">Through another web site. Which one?

<input id="How did you hear about us" maxlength="50" name="How did you hear about us" size="20" type="text" /></td>
</tr>
<tr>
<td align="left" valign="top"><input id="How did you hear about us" name="How did you hear about us" type="checkbox" value="I met Simla at an event." /></td>
<td align="left" valign="top">I met Simla at an event.</td>
</tr>
<tr>
<td align="left" valign="top"><input id="How did you hear about us" name="How did you hear about us" type="checkbox" value="Some other way." /></td>
<td align="left" valign="top">Some other way. Please describe:

<input id="How did you hear about us" maxlength="50" name="How did you hear about us" size="20" type="text" /></td>
</tr>
</tbody></table>
</form> <form action="http://www.enjoydelicioushealth.com/cgi-bin/FormMail.pl" method="POST">
<table border="0" cellspacing="3" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="padding-top:15px;" colspan="2" valign="top"><strong>Is there anything else you’d like to share with us? A specific question, perhaps, or a little more about what brought you to us?</strong></td>
</tr>
<tr>
<td></td>
<td><textarea id="textarea" cols="45" rows="5" name="other information"></textarea></td>
</tr>
<tr>
<td valign="top"></td>
<td style="padding-left: 215px;padding-top:15px;" valign="top"><input style="padding:3px;background-color:#FFE040;text-transform:uppercase;font-size:10px;" type="submit" value="Submit" /> <input style="padding:3px;background-color:#FEF9D9;text-transform:uppercase;font-size:10px;" type="reset" value="Clear Form" /></td><input type=hidden name="redirect" value="http://enjoydelicioushealth.com/?p=196">
</tr>
</tbody></table><input type=hidden name="recipient" value="hello@enjoydelicioushealth.com">

</form>

pandy
You use the same few IDs and names over and over. They can only be used once. Their values contain spaces which isn't allowed.
http://www.w3.org/TR/html401/types.html#type-id

Not related to your problem, but there are also a lot of so called 'illegal' windows characters. The validator tells you where. It tells you about the name and id problem too. And don't write web stuff in Word. happy.gif
http://htmlhelp.com/tools/validator/
nater
QUOTE(pandy @ Jun 19 2009, 10:21 AM) *

You use the same few IDs and names over and over. They can only be used once. Their values contain spaces which isn't allowed.
http://www.w3.org/TR/html401/types.html#type-id

Not related to your problem, but there are also a lot of so called 'illegal' windows characters. The validator tells you where. It tells you about the name and id problem too. And don't write web stuff in Word. happy.gif
http://htmlhelp.com/tools/validator/


Thank you Pandy. I didn't write the form (& i despise MS word- lol), I was just trying to edit it for a client.

It was working correctly until I moved the contact info to the top.

Would it be easier to just create a new form instead of fixing this one, or do these problems seem like a fairly quick fix?

nater
I found the problem!!!

There was an extra </form> so my form was only getting the last text box.

Thank you all for your help!

Nater
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.