View Full Version : contact form php help

05-19-2011, 05:45 AM
Hey again, I've been coding a contact page for my website using php and I've got everything working, like it sends to my email ect, but I'm trying to add a confirmation page, that says for example: Thank You For Contacting Us!, and I basically followed this tutorial that said you can use this bit of code, and it does bring you to a new page but none of my styling works on it

$TheResults = <<<EOD
I copied the code from my contact page and replaced the contents of the maintext div with what I wanted it to say

echo "$TheResults"

www.brave-design.ca/contact.html (http://www.brave-design.ca/contact.html)

I'm not sure if this is even possible or if there's a better way you guys know of,

thanks again, Josh:)

05-19-2011, 05:47 AM


/*Subject and Email Variables*/

$emailSubject = 'Brave-Design Contact Form!';
$webMaster = 'joshjames@love.com';

/*Gathering Data Variables*/

$nameField = $_POST['name'];
$emailField = $_POST['email'];
$messageField = $_POST['message'];
$subscribeField = $_POST['subscribe'];

$body = <<<EOD
Name: $name <br>
Email: $email <br>
Message: $message <br>
Subscribe: $subscribe <br>

$headers = "From: $email\r\n";
$headers .= "Content-Type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);

/*Results Rendered in HTML*/

$TheResults = <<<EOD
/*Entire HTML code from my contact page*/

echo "$TheResults"


05-19-2011, 06:03 AM
Hiya, moved to PHP board.

You need to redirect after send so try something like;


at the end of your code (before the closing curly brace).