Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I've got a contact form that was working fine on my testing server, but when it was uploaded to my client's server, it stopped working correctly. It helped a good deal when they installed php (duh) but I'm still getting an error for the checkboxes if they are left blank. It works fine if all fields are filled, but if these checkboxes are left blank, I get an error mesage. (Still waiting for word on what kind of server they're on.)
Here's the error message:
[quote]Notice: Undefined index: plugs in W:\websites\business\acf\acfplugs\feedback.php on line 18
Notice: Undefined index: hanging in W:\websites\business\acf\acfplugs\feedback.php on line 20
Warning: Cannot modify header information - headers already sent by (output started at W:\websites\business\acf\acfplugs\feedback.php:18) in W:\websites\business\acf\acfplugs\feedback.php on line 58
[/quote]
Here's the html:
[syntax="html"] <p> Which products interest you: </p>
<p>
<label>
<input name="plugs" type="checkbox" id="plugs" value="x" />
Plugs </label>
<br />
<label>
<input name="bedding" type="checkbox" id="bedding" value="x" />
Bedding Plants </label>
<br />
<label>
<input name="hanging" type="checkbox" id="hanging" value="x" />
Pots and Hanging Baskets </label>
<br />
<label>
<input name="strawberry" type="checkbox" id="strawberry" value="x" />
Strawberry plugs </label>
<br />
<label> <br />
Comments
<textarea name="comment" cols="50" rows="8" id="comment"></textarea>
</label>
</p>
Code: Select all
<?php
$send_to = "linda@lkcwebdesign.com";
$recipient = "linda@lkcwebdesign.com";
$subject = "Aarons Creek Farm Feedback";
$additional_headers = "From: linda@lkcwebdesign.com\r\n";
$additional_headers .="Content-type: text/html; charset=iso-8859-1\r\n";
$company = $_POST['company'] ;
$name = $_POST['name'] ;
$street = $_POST['street'];
$city = $_POST['city'] ;
$state = $_POST['state'] ;
$zip = $_POST['zip'] ;
$phone = $_POST['phone'] ;
$faxnumber = $_POST['faxnumber'] ;
$emailaddress = $_POST['emailaddress'];
$plugs = $_POST['plugs'] ;
$bedding = $_POST['bedding'] ;
$hanging = $_POST['hanging'] ;
$strawberry = $_POST['strawberry'] ;
$comment = $_POST['comment'] ;
$http_referrer = getenv( "HTTP_REFERER" );
$email_body =
'
<html>
<head>
<title>Aarons Creek Farms Tour — Attendance Feedback</title>
</head>
<body>
<table width="554" border="0" align="center" cellpadding="10" cellspacing="0">
<tr>
<td width="534" valign="top" bgcolor="#F4FFFF"> <div align="center">
<h1>ACF Feedback </h1>
</div>
<p>Company: '.$company.' </p>
<p>Name: '.$name.' </p>
<p>Email address: '.$emailaddress.'</p>
<p>Street: '.$street.' </p>
<p> City: '.$city.' </p>
<p> State: '.$state.' </p>
<p> Zip: '.$zip.' </p>
<p>Fax number: '.$faxnumber.' </p>
<p>Plugs: '.$plugs.' </p>
<p>Bedding: '.$bedding.' </p>
<p>Hanging: '.$hanging.' </p>
<p>Strawberry: '.$strawberry.' </p>
<p> Comments: '.$comment.' </p> </td>
</tr>
</table>
</body>
</html>
';
if(mail($send_to,$subject,$email_body,$additional_headers)){
header("location: http://www.acfplugs.com/thank-you.htm");
}else{
header("location: http://www.acfplugs.com/error-form.htm");
}
?>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]