I’m not a PHP guy so I googled and found some simple code for a contact form via kirupa.com Everything works great, however I’d love to serve up a custom thank you / acknowledgement page instead users getting a simple echo text “Data has been submitted to your@email.com!” on a white blank page.
My contact form:
http://leongaban.com/contact.html
Here is the PHP code:
<?php
if(isset($_POST['submit'])) {
$to = "your@email.com";
$subject = "Form My website";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];
$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";
echo "Data has been submitted to $to!";
mail($to, $subject, $body);
} else {
echo "error! :'(";
}
?>
How should I edit this code to serve the users a thankyou.html page after they send an email?
use header function http://php.net/manual/en/function.header.php