One of the most common questions that people as is how to redirect the “PHP Contact Form”. And since people either fail at searching or are just to lazy here’s how you do it. Here’s the final code from the tutorial:
<?php
if(isset($_POST['submit'])) {
$to = "you@you.com";
$subject = "Form Tutorial";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];
$body = "From: $name_field
E-Mail: $email_field
Message:
$message";
echo "Data has been submitted to $to!";
mail($to, $subject, $body);
} else {
echo "blarg!";
}
?>
change
echo "Data has been submitted to $to!";
to
header("Location: http://www.yourpage.com");