needyourhelp
02-28-2012, 01:32 PM
Hello,
I sent a thread out yesterday about a form i was creating. I have got a form that is working correctly as far as it sends the email to me and forwards a thank you email to the client however when they press submit it is supposed to go to a thankyou.html with a brief message however it is producing the following error:
Warning: Cannot modify header information - headers already sent by (output started at /homepages/1/d403557934/htdocs/contact.php:1) in /homepages/1/d403557934/htdocs/contact.php on line 29
The contact.php file i have created has the following coding:
<?php
$to = $_REQUEST['sendto'] ;
$from = $_REQUEST['Email'] ;
$name = $_REQUEST['Name'] ;
$headers = "From: $from";
$subject = "Web Contact Data";
$fields = array();
$fields{"Name"} = "Name";
$fields{"Company"} = "Company";
$fields{"Email"} = "Email";
$fields{"Phone"} = "Phone";
$fields{"list"} = "Mailing List";
$fields{"Message"} = "Message";
$body = "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$headers2 = "From: noreply@europeantextiles.co.uk";
$subject2 = "Thank you for contacting us";
$autoreply = "Thank you for contacting us. Somebody will get back to you as soon as possible, usualy within 24 hours. If you have any more questions, please consult our website at www.europeantextiles.co.uk";
if($from == '') {print "You have not entered an email, please go back and try again";}
else {
if($name == '') {print "You have not entered a name, please go back and try again";}
else {
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
if($send)
{header( "Location: www.cash4usedclothing.co.uk/thankyou.html" );}
else
{print "We encountered an error sending your mail, please notify info@europeantextiles.co.uk"; }
}
}
?>
Where am i going wrong, i can see the light at the end of the tunnel but i just cant get there!
I look forward to your help.
I sent a thread out yesterday about a form i was creating. I have got a form that is working correctly as far as it sends the email to me and forwards a thank you email to the client however when they press submit it is supposed to go to a thankyou.html with a brief message however it is producing the following error:
Warning: Cannot modify header information - headers already sent by (output started at /homepages/1/d403557934/htdocs/contact.php:1) in /homepages/1/d403557934/htdocs/contact.php on line 29
The contact.php file i have created has the following coding:
<?php
$to = $_REQUEST['sendto'] ;
$from = $_REQUEST['Email'] ;
$name = $_REQUEST['Name'] ;
$headers = "From: $from";
$subject = "Web Contact Data";
$fields = array();
$fields{"Name"} = "Name";
$fields{"Company"} = "Company";
$fields{"Email"} = "Email";
$fields{"Phone"} = "Phone";
$fields{"list"} = "Mailing List";
$fields{"Message"} = "Message";
$body = "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$headers2 = "From: noreply@europeantextiles.co.uk";
$subject2 = "Thank you for contacting us";
$autoreply = "Thank you for contacting us. Somebody will get back to you as soon as possible, usualy within 24 hours. If you have any more questions, please consult our website at www.europeantextiles.co.uk";
if($from == '') {print "You have not entered an email, please go back and try again";}
else {
if($name == '') {print "You have not entered a name, please go back and try again";}
else {
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
if($send)
{header( "Location: www.cash4usedclothing.co.uk/thankyou.html" );}
else
{print "We encountered an error sending your mail, please notify info@europeantextiles.co.uk"; }
}
}
?>
Where am i going wrong, i can see the light at the end of the tunnel but i just cant get there!
I look forward to your help.