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 protected]";$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("[email protected]", "Prospect Contact Info", $message1, $from);mail("[email protected]", "Prospect Contact Info", $message1, $from)?> Link to comment https://forums.phpfreaks.com/topic/285341-php-help-new-to-this-__/ 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 protected]";$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("[email protected]", "Prospect Contact Info", $message1, $from);mail("[email protected]", "Prospect Contact Info", $message1, $from)?> Link to comment https://forums.phpfreaks.com/topic/285341-php-help-new-to-this-__/#findComment-1465115 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.