Ahoy!
Any help on this would be really appreciated! I have a contact form which is sending emails on a page refresh. I have tried a number of things and am not getting anywhere.. Heres what Ive got so far:
if(isset($_POST['email']) && $_POST['email'] != '') {
if( filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) ){
$userName = $_POST['name'];
$userEmail = $_POST['email'];
$messageSubject = $_POST['subject'];
$message = $_POST['message'];
$to = "email@gmail.com";
$body = "";
$body .= "From: " .$userName. "\r\n";
$body .= "Email: " .$userEmail. "\r\n";
$body .= "Message: " .$message. "\r\n";
header('Location: http://www.website.net/contact-thank-you.html');
exit();
mail($to, $messageSubject, $body);
}
}
?>