scCam86 Posted January 13, 2014 Share Posted January 13, 2014 Okay, so when I hit submit, it goes to /php/contactus.php instead of /thank-you.html, but it still displays the content of the /thank-you.html page I'm not sure what I'm doing wrong, and It's been eating me alive for a few hours. I know it's something simple that I'm overlooking. Here's the code.... The code functions properly, otherwise. It sends one email to "$email" and it sends two copies of just the data posted to the other emails.It just doesn't direct to the "thank you" page. ---- <?php$subject = "Thanks For Connecting With Me!";$from = "email@email.com";$fromName = "Name Here";$name = $_POST["name"];$email = $_POST["email"];$region = $_POST["region"];$notes = $_POST["notes"];$message1 = "Prospect Name: " . $name . "\nProspect Email: " . $email . "\nProspect Phone: " . $phone . "\nProspect Region: " . $region . "\nProspect Notes: " . $notes;$message2 = "blah, blah, blah";if(mail($email, $subject, $message2, $from)){ header("Location: ../thank-you.html");}else{ echo "Message was not sent!";}mail("email1@gmail.com", "Prospect Contact Info", $message1, $from);mail("email2@gmail.com", "Prospect Contact Info", $message1, $from)?> Quote Link to comment Share on other sites More sharing options...
taquitosensei Posted January 13, 2014 Share Posted January 13, 2014 you need an exit; after the header redirection.Without more info I think that will take care of it. Also...use code tags. It will make it much easier for people to read. if(mail($email,$subject,$messag2,$from)){ header("Location: ../thank-you.html"); exit; } Okay, so when I hit submit, it goes to /php/contactus.php instead of /thank-you.html, but it still displays the content of the /thank-you.html page I'm not sure what I'm doing wrong, and It's been eating me alive for a few hours. I know it's something simple that I'm overlooking. Here's the code.... The code functions properly, otherwise. It sends one email to "$email" and it sends two copies of just the data posted to the other emails.It just doesn't direct to the "thank you" page. ---- <?php$subject = "Thanks For Connecting With Me!";$from = "email@email.com";$fromName = "Name Here";$name = $_POST["name"];$email = $_POST["email"];$region = $_POST["region"];$notes = $_POST["notes"];$message1 = "Prospect Name: " . $name . "\nProspect Email: " . $email . "\nProspect Phone: " . $phone . "\nProspect Region: " . $region . "\nProspect Notes: " . $notes;$message2 = "blah, blah, blah";if(mail($email, $subject, $message2, $from)){ header("Location: ../thank-you.html");}else{ echo "Message was not sent!";}mail("email1@gmail.com", "Prospect Contact Info", $message1, $from);mail("email2@gmail.com", "Prospect Contact Info", $message1, $from)?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.