I have a PHP email form embedded at the top of the HTML of my contact form page (index.php):
<?php
if (isset($_POST["submit"])) {
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$from = 'Camino Contact Form';
$to = 'email@example.com';
$subject = 'Message Contact Form ';
$body ="From: $name
E-Mail: $email
Message:
$message";
if (!$errName && !$errEmail && !$errMessage) {
if (mail ($to, $subject, $body, $from)) {
$result='<div>Thank You! I will be in touch</div>';
} else {
$result='<div>Sorry there was an error sending your message.</div>';
}
}
}
?>
HTML:
<form role="form" method="post" action="index.php">
...
</form>
and I wanted to hide the form only after successful submission. How can I do this?