hi! I am using following coding as a PHP + HTML contact form:-
<html>
<head>
</head>
<body>
<?php
if(isset($_POST['email'])){
$email = $_POST['email'];
$recipient = "myemail@myemail.com,";
$subject = "Contact Form Email Subject";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $mailheader) or die("Error!");
$msg = "<font color='green' size='3'>Thank You for your message.</font>";
echo $msg;
}
?>
<form method="POST">
<p align="center">
Enter your valid email id:
<br>
<input type="text" name="email">
<br>
<input type="submit" value="Subscribe now!">
</form>
<?php
echo $msg;
?>
</body>
</html>
I am getting a problem: The text: [ Thank You for your message."; echo $msg; } ?> ] is showing up at the top of form even before submission.
The form is sending the email but it is not showing the text [ Thank You for your message. ] blow the form after sending email.