Jump to content

[SOLVED] Redirect after mail is sent


denoteone

Recommended Posts

so far I have this in my mail.php file

 

$name = $_POST['name'];
$email = $_POST['email'];
$comments = $_POST['message'];
$message = 'The following email came in from '.$name.'<br><br> '.$comments.'';
$subject = "Mail From Head Nods";
$headers  = 'From: '.$email.'\r\n';
$headers .= "Reply-To:*******@gmail.com\r\n"; 
$headers .= "Content-type: text/html\r\n";


mail('*******@gmail.com',$subject,$message,$headers);

 

now after the mail is sent I want the user to be sent to thankyou.html

Link to comment
https://forums.phpfreaks.com/topic/129449-solved-redirect-after-mail-is-sent/
Share on other sites

A little more

if(mail('*******@gmail.com',$subject,$message,$headers)){
    header('Location: /thankyou.php');
}else{
    header('Location: /error.php');
}

Just checks to make sure there wasn't an error sending the mail and having the user get hung up on an error page

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.