Jump to content

Contact form subscripltion works put does not echo to subscriber that message has been sent.


DJBOZIAH

Recommended Posts

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");	


}
?>

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.