I have an email form that is sending perfectly but when I send it, I get the Message "Thank you for your Submission" but it also reloads the form again right after it. How can I have the form submit, but only respond with the "success" message instead of the form again too?
Here is the PHP for the form:
PHP Code:
<?php
if($_POST){ $to = $_POST['First_and_Last_Name']; $subject = "WHAT SHOULD THIS BE"; $message = "Blah blah blah. Blah blah blah. Blah blah blah. Blah blah blah. Blah blah blah."\n\r". "Sincerely,\n". "From: " .$_POST['from']. "\n". "Street: " .$_POST['street']. "\n". "City: " .$_POST['city']. "\n". "Zip: " .$_POST['zip']. "\n". "Email: " .$_POST['email']. "\n". $headers = "From: " .$_POST['from']. "<".$_POST['email'].">"."\n"; mail($to, $subject, $message, $headers); // SUCCESS! echo '<p class="notice">'. 'Thank you for your submission. '. '</p>'; // clear out the variables for good-housekeeping unset($date,$name,$street,$city,$zip,$email); $_POST = array(); } ?>
Why does the form load again after submission?
|