satbir Posted January 21, 2017 Share Posted January 21, 2017 I have 3 pages. form for sending email is send-mail.php ..... the coding of sending email is in email.php and then thanks.php and at last redirects to main page of website. on click on button in send-mail.php...... page the coding of sending email is working well but headers not working. after sending email page is not redirecting to thanks.php and not redirecting to main page of website. ... send-mail.php <?php error_reporting(E_ALL); ini_set('display_errors', '1'); ob_start(); ?> <button class="btn btn-default" name="submit"> --> Send --> </button> email.php <?php error_reporting(E_ALL); ini_set('display_errors', '1'); ob_start(); ?> $headers .= "To: $to" . "\r\n"; $headers .= "From: $email" . "\r\n"; $headers .= "Cc: $cc" . "\r\n"; $headers .= "Bcc: $bcc" . "\r\n"; mail($to,$subject,$message,$headers); header('Location:thanks.php'); thanks.php <?php error_reporting(E_ALL); ini_set('display_errors', '1'); ob_start(); ?> <?php header("Location:refresh:3;url=http://www.myWebsite.com"); ?> Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted January 21, 2017 Share Posted January 21, 2017 (edited) What are you seeing on the screen when the mail has been sent and no redirect happens? Or more importantly, what does the page source look like? The code looks strange, to say the least. Are the missing PHP tags around the mail code a copy-and-paste error? Why are you printing error messages on the screen? This is a terrible idea on a public site, and it will indeed break header() calls. And why do you use output buffering? Edited January 21, 2017 by Jacques1 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.