Hi, Right now my contact form redirects to either an error.html or thankyou.html after you hit submit. How can I make it so that the form stays on the same page, and simply inserts a message right under the form saying "Thank you, form submitted" or "Error, please try again" Here's my code... <?php include("global.inc.php"); $errors=0; $error="The following errors occured while processing your form input.<ul>"; pt_register('POST','Name'); pt_register('POST','Email'); pt_register('POST','ProjectType'); pt_register('POST','Industry'); pt_register('POST','Pages'); if($Name=="" || $Email=="" || $ProjectType=="" || $Industry=="" || $Pages=="" ){ $errors=1; } if($errors) { header("Location: error.html"); } else{ $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/")); $message="Name: ".$Name." Email: ".$Email." ProjectType: ".$ProjectType." Industry: ".$Industry." Pages: ".$Pages." "; $message = stripslashes($message); mail("myemail@here.com","QuickQuote Form",$message,"From: website form"); header("Refresh: 0;url=thankyou.html"); ?><?php } ?> Code (markup): Thank you!
<?php include("global.inc.php"); $errors=0; $error="The following errors occured while processing your form input.<ul>"; pt_register('POST','Name'); pt_register('POST','Email'); pt_register('POST','ProjectType'); pt_register('POST','Industry'); pt_register('POST','Pages'); if($Name=="" || $Email=="" || $ProjectType=="" || $Industry=="" || $Pages=="" ){ $errors=1; } if($errors) { echo $error; } else{ $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/")); $message="Name: ".$Name." Email: ".$Email." ProjectType: ".$ProjectType." Industry: ".$Industry." Pages: ".$Pages." "; $message = stripslashes($message); mail("myemail@here.com","QuickQuote Form",$message,"From: website form"); echo 'Thank you message'; ?><?php } ?> Code (markup):
Could you tell me what your global.inc.php file looks like (whether there's some redirects there). Don't include any mysql usernames/passwords. These should appear on the same page but the form won't display once you've submitted it.