I am virtually clueless where PHP is concenned and I was hoping someone would be able help me solve a problem with the response form that I currently have on my website.
When the form is filled in and "submit" is clicked – I get this message in the browser:
Warning: Cannot modify header information - headers already sent by (output started at /home/graphi31/public_html/response.php:12) in /home/graphi31/public_html/response.php on line 28
What is supposed to happen is that it should show a thank you page – thanks.html which is in the directory, as it has always been.
Oddly, this did not happen before, the only recent change I can think of is that I have changed my hosting to JustHost.
I'd be most grateful for any advice on how to fix this as it is driving me nuts.
I am virtually clueless where PHP is concenned and I was hoping someone would be able help me solve a problem with the response form that I currently have on my website.
When the form is filled in and "submit" is clicked – I get this message in the browser:
Warning: Cannot modify header information - headers already sent by (output started at /home/graphi31/public_html/response.php:12) in /home/graphi31/public_html/response.php on line 28
What is supposed to happen is that it should show a thank you page – thanks.html which is in the directory, as it has always been.
Oddly, this did not happen before, the only recent change I can think of is that I have changed my hosting to JustHost.
I'd be most grateful for any advice on how to fix this as it is driving me nuts.
Thanks in advance...
Ian.
Details:
My Contact page address is
http://www.graphicalchemy.co.uk/contact.html
The PHP for the response form looks like this:
<?php
// Configuration Settings
$SendFrom = "Graphic Alchemy <info@graphicalchemy.co.uk>";
$SendTo = "ian1618@googlemail.com";
$SubjectLine = "Portfolio Response";
$ThanksURL = "thanks.html"; //confirmation page
// Build Message Body from Web Form Input
foreach ($_POST as $Field=>$Value)
$MsgBody .= "$Field: $Value\n";
$MsgBody .= "\n" . @gethostbyaddr($_SERVER["REMOTE_ADDR"]) . "\n" .
$_SERVER["HTTP_USER_AGENT"];
$MsgBody = htmlspecialchars($MsgBody, ENT_NOQUOTES); //make safe
// Send E-Mail and Direct Browser to Confirmation Page
mail($SendTo, $SubjectLine, $MsgBody, "From: $SendFrom");
header("Location: $ThanksURL");
?>
I tried this code but it still gives the same error message.
Kelpie.
That did the trick perfectly.
Regards,
kelpie.