Hi, my form to email does work, I just want an event to happen when you click submit. When a user clicks submit, I want them to be taken to a thank you page. I created a success.html page but am not sure how to code it in so this event occurs. Here is my code, I will leave out password and personal email information. Thank you. <?php require_once "Mail.php"; if (isset($_POST['submit'])) { // get name $name = trim($_POST['name']); // get email address $email = trim($_POST['email']); // get comments $comments = $_POST['comments']; $comments = trim($comments); $comments = stripslashes($comments); $comments = htmlspecialchars($comments); } $from = $_POST['email']; $to = "Me <[email protected]>"; $subject = "Comments from website"; $body = $_POST['comments']; $host = "mail.domain.com"; $username = "[email protected]"; $password = "password"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); // check antiSpam field $antiSpam = trim($_POST['antiSpam']); if (!empty($antiSpam)) { exit; } ?>
Looking around on the internet and I was able to find this web page article here: http://stackoverflow.com/questions/15800785/how-can-i-redirect-to-a-thank-you-page-in-php And this web page article here: http://stackoverflow.com/questions/13516836/how-to-redirect-contact-form-to-thank-you-page