please help!
there is a feedback form i need to make work but it is in php and i have never used php before
http://www.keystonecoaching.co.za/test/contact_php.htm
(its a generic form i found but i cant make it work as you will see the error i receive is
Warning: Cannot modify header information - headers already sent by (output started at /home/keystone/public_html/test/contact.php:3) in /home/keystone/public_html/test/contact.php on line 31
i was told that this is because i am putting the php script on the .php file below the head section. so i moved it but still nothing … where must this php script be placed??
here is a copy of the .php page … im not sure what else you need
i would really appreciate the help … do i perhaps just delete all the html stuff and only have the .php script?
<?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: [email protected]”;
$subject2 = “Thank you for contacting us”;
$autoreply = “Thank you for contacting us. Somebody will get back to you as soon as possible, usually within 48 hours. If you have any more questions, please consult our website at www.keystonecoaching.co.za”;
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: http://www.keystonecoaching.co.za/test/confirm.htm” );}
else
{print “We encountered an error sending your mail, please notify [email protected]”; }
}
}
?>