DJBOZIAH Posted June 4, 2020 Share Posted June 4, 2020 My Contact form subscripltion works put does not echo to subscriber that message has been sent..I am not sure how to get the response message to display on page after subscribing. Here is my my html code <?php if (isset($_POST['submit'])) { $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['msg']; $mailto = "support@playkenyamusic.com"; $headers = "From: ".$email; $headers .= "Cc: djboziah@gmail.com \r\n"; $txt = "You have a message From ".$name.".\n\n".$message; mail($mailto, $email, $txt, $headers); echo $_POST["msg"]; if(!$email->send()) { echo "Mailer Error: " . $email->ErrorInfo; } else { echo "Message has been sent successfully"; } header("Location: form-to-email.php?emailsent"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/310887-contact-form-subscripltion-works-put-does-not-echo-to-subscriber-that-message-has-been-sent/ Share on other sites More sharing options...
requinix Posted June 4, 2020 Share Posted June 4, 2020 Multiple possible issues here, but to aim for the one that's on-topic: You cannot redirect and output a message at the same time. Only one can happen. I don't know your application or how this script is being used, but my first suggestion would be to forget the redirect and instead show a whole HTML page with the message. Quote Link to comment https://forums.phpfreaks.com/topic/310887-contact-form-subscripltion-works-put-does-not-echo-to-subscriber-that-message-has-been-sent/#findComment-1578624 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.