This is the end of the script:- /* PHP form validation: the script checks that the Email field contains a valid email address and the Subject field isn't empty. preg_match performs a regular expression match. It's a very powerful PHP function to validate form fields and other strings - see PHP manual for details. */ if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $email)) { echo "<h4>Invalid email address</h4>"; echo "<a href='java_script:history.back(1);'>Back</a>"; } elseif ( preg_match( "/[\r\n]/", $name ) || preg_match( "/[\r\n]/", $email ) ) { echo "<h4>characters not allowed in this field</h4>"; echo "<a href='java_script:history.back(1);'>Back to e mail form</a>"; } elseif ($email == "") { echo "<h4>You must enter an e mail address</h4>"; echo "<a href='java_script:history.back(1);'>Back to e mail form</a>"; } /* Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise. */ elseif (mail($recipient,$email,$message, $from)) { // Where to redirect after form is processed. echo "<h4>Thank you</h4>"; } else { echo "<h4>Can't send email</h4>"; } ?> I want the form to put up an html confirmation page - which also has normal menu links to continue using the website. From what I can read.. header("Location: http://www.example.com/page.html"); exit; this should go in at the end of the script to function. putting in before the ?> does not work. I know basically nothing about PHP scripting. Any help appreciated TIA Art
Very generally speaking, it appears the portion of code you posted attempts to validate that the submitted input on the form is "valid" and then sends an e-mail. It also sounds like you want to insert this code... header("Location: http://www.example.com/page.html"); exit; Code (markup): ...somewhere at the "end" of the script so that presumably the user is re-directed back to a specific page after the script sends out the e-mail. Or something like that. I'm just not sure. But assuming that's what you want to have happen, I'd try replacing this line of code... echo "<h4>Thank you</h4>"; Code (markup): ...with this line of code... header("Location: http://www.example.com/page.html"); die(); Code (markup): Try that and see what happens, good luck!
Hi, Thanks for your reply...... however, I have tried that previously and it does not work, and your amendment to "); die(); give the same none result as exit. The result is - instead of getting the dark grey PHP page withe the "Thank you" msg - its just blank. The form is sent - but leaves the less informed with - to them - no guiding menu, yes they can use the browser back button - but I have to contend with the user perhaps - either not wanting to do that (!) or not knowing how to. I also think the sender would appreciate a return to the form page and a menu to other area's. I had put up a modified " reply form" which returned to the sending page. BUT the items showed in the email as qty XXXX Item XXXXX and they wanted Qty xxxx Item XXXXXX to avoid "confusion ! Thanks for your reply Art