Hey, I assume this will be an easy question for you. What I want is to have a form that a user can fill out, hit send, and it will send an email with the info to my email address. I have that all figured out and it works.
What I cannot figure out how to do is when they hit the submit button, I want them to be sent to a certain page on my site instead of the 'echo' command. I've spent hours searching for a quick answer to this but have been unsuccessful. Thank you for your help!
Here's my mailer.php code:
<?php
if(isset($_POST['submit'])) {
$to = "mywebsite@mydomain.net";
$subject = "Contact";
$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 "Message sent!";
mail($to, $subject, $body);
} else {
echo "There was an error";
}
?>