<html> <body> <?php if (isset($_REQUEST['email'])) //if "email" is filled out, send email { //send email $name = $_REQUEST['name']; $email = $_REQUEST['email'] ; $phone = $_REQUEST['phone']; $location = $_REQUEST['location']; $foundus = $_REQUEST['foundus']; $questions = $_REQUEST['questions']; mail( "steinfeldtt@yahoo.com", "Quote: $name - from $name", "Questions: $questions\nEmail: $email\nPhone: $phone\nName: $name\nLocation: $location\nHow I found you: $foundus" ); echo "Thank you for using our mail form. Click <a href='index.html'>here</a> to go back."; } else //if "email" is not filled out, go back to the form page { header( 'Location: javascript: history.go(-1)' ) ; } ?> </body> </html> hmmmmmmmm.....it works together with http://acarniball.com/contact.html Thanks!
Your syntax looks ok. However, the above will NOT work - you have already outputted (<html><body>) so you cannot use the header function.
Try this way: else //if "email" is not filled out, go back to the form page { echo 'Email is not filled out, go back to the form page: <a href="#" onclick="javacript:history.go(-1);">Go Back</a>'; } Code (markup):