I'm facing two issue with the following code.
The code is below :
<?php
if(isset($_POST['submit'])){
$email=$_POST['email'];
//send mail
$to='info@soapbox.media';
$subject='New Subscriber';
$body='<html>
<body>
<h3>Feedback</h3>
<hr>
<p> Email :<br/>'.$email.'</p>
</body>
</html>';
$headers ="From:<".$email.">
";
$headers .="reply-To:".$email."
";
$headers .="NINE-Version: 1.0
";
$headers .="Content-type: text/html; charset=utf-8";
//confirmation mail
$user=$email;
$usersubject = "SoapBox";
$userheaders = "From: info@soapbox.media
";
$usermessage = "Thank you for subscribing SoapBox.";
//sending process
$send=mail($to, $subject, $body, $headers);
$confirm=mail($user, $usersubject, $userheaders,$usermessage );
if($send && $confirm){
echo "<div class='alert alert-success alert-dismissible fade show'>
<button type='button' class='close' data-dismiss='alert'>×</button>
<strong>Success!</strong> You have subscribed successfully.
</div>";
}
else{
echo "Failed";
}
}
?>
$confirm=mail($user, $usersubject, $usermessage, $userheaders);
by @Funk Forty Niner
place a header('location: ' . $_SERVER['PHP_SELF']);
after you've sent the mail - you will get rid of the post-header, so no more popup after F5 - You will get rid of your confirmation msg aswell so you could add a GET
parameter to your URL to show the confirmation message.