HigherHigher
IS-IT--Management
Afte I submit form, I want the form to display "Your Ergo4me form has been sent. An ergo4me presentative will contact you shortly. T. This code is within the PHP codes and does not show when I successfuly submit the form.
Why?
Please take a look at my code. Thank you.
<?php
#
# NL-PHPMail v1.5
# Copyright 2002-2003 Sasha, All rights reserved.
# First released December 11, 2002
# This version released October 6, 2003
#
# NL-PHPMail v1.5 is linkware and can be used or modified as long as this note remains intact
# and unaltered, and there is a link up back to so people know where you got this script. You are forbidden to sell or distribute the code of NL-PHPMail v1.5, in whole
# or part, without the written consent of Sasha.
#
# By using NL-PHPMail v1.5 you agree to indemnify Sasha from any liability.
#
# Website: # FAQ: # Support: #
// -----------------------
//VARIABLES NEEDED FOR THE SCRIPT TO WORK, PLEASE CHANGE THESE AS SPECIFIED
// -----------------------
//Your email address (where the form will be sent):
$recipient = 'smah@shm-design.com';
//The subject of the email:
$subject = 'Ergo4me Form';
//Change this to the URL to your HTML form.
$form_url = '
//If you're using Headers and Footers with PHP, please fill in the path to them below. This can be a relative path (like, header.inc if it's in the same directory), or an absolute path. If you're NOT using headers, please leave this empty.
$header ='';
$footer ='';
//Below is the content of the actual email sent to you. If you have different or more form fields than specified here, copy and paste the below line (without the // in front of it) into the coding bit below. Beneath the Comments line would be a good place for it:
// $msg .= "Field Description: $_POST[field_name]\n";
// Change the description and field name to match the field in your form. The $_POST[field_name] variable is what takes the contents of the form fields, so change "field_name" to the name of your form field. The . in front of the = sign merely means that line will be added to the variable, along with all previous lines, instead of overwriting it, so don't take it out! Use \t to insert a tab, and \n to insert a new line.
$msg = "---------------\n";
$msg .= "$subject\n";
$msg .= "---------------\n\n";
$msg .= "Name: $_POST[name]\n";
$msg .= "Email: $_POST\n";
$msg .= "Phone: $_POST[phone]\n";
$msg .= "Comments: $_POST[comments]\n";
// Change the names below to the 2 required fields in your form. If these fields are not filled out, the script will not send an email and display an error message instead, asking the visitor to fill out the form again.
$req1 ="$name";
$req2 ="$email";
//The below error message will be displayed if not all required fields are filled in. Feel free to use normal HTML in this.
$error_required = '<p>It appears you forgot to enter either Your email address or Your full name.<br />Please press the BACK button in your browser and try again.</p>';
//The below error message will be displayed if the visitor submitted an invalid email address. Feel free to use normal HTML in this.
$error_email = '<p>Oops, it appears that the email address you filled in is not a valid one. Please press the back button on your browser and try again. Please check carefully that you filled in all information in the right fields!</p>';
//The below success message will be displayed when the form is sent. Feel free to use normal HTML in this.
$success_message = '<p>Your Ergo4me form has been sent. An ergo4me presentative will contact you shortly. T </p>';
// -----------------------
//DO NOT EDIT ANYTHING BELOW UNLESS YOU KNOW WHAT YOU'RE DOING!!
// -----------------------
if ($header ==""){
$use_headers ='0';
$header = '<html><head><title>Website Quote Form</title></head><body>';
} else {$use_headers ='1';}
if ($footer ==""){
$use_footers ='0';
$footer = '<div id="content"></div></body></html>';
} else {$use_footers ='1';}
function is_valid_email ($address) {
return (preg_match(
'/^[-!#$%&\'*+\\.\/0-9=?A-Z^_`{|}~]+'.
'@'.
'([-0-9A-Z]+\.)+' .
'([0-9A-Z]){2,4}$/i',
trim($address)));
}
function is_valid_email_eregi ($address) {
return (eregi(
'^[-!#$%&\'*+\\./0-9=?A-Z^_`{|}~]+'.
'@'.
'([-0-9A-Z]+\.)+' .
'([0-9A-Z]){2,4}$',
trim($address)));
}
if (!isset($req1) || !isset($req2) || !isset($req3)) {
header( "Location: $form_url" ); }
elseif (empty($req1) || empty($req2) || empty($req3)) {
if ($use_headers =="0"){
echo "$header";
} else { include ("$header"); }
?>
<h2>Error</h2>
<?=$error_required?>
<?
if ($use_footers =="0"){
echo "$footer";
} else { include ("$footer"); }
}
else {
$f_email = $_POST[email];
$f_email = strtolower(trim($f_email));
if (is_valid_email($f_email)) {
$msg .= "\n\n---------------\n";
$msg .= "Life is good./\n";
$msg .= "---------------\n\n";
$mailheaders = "MIME-Version: 1.0 \n";
$mailheaders .= "Content-type: text/plain; charset=iso-8859-1 \n";
$mailheaders .= "From: \"$_POST[email]\" <$_POST[email]> \n";
$mailheaders .= "Reply-To: \"$_POST[email]\" <$_POST[email]> \n";
$mailheaders .= "X-Priority: 3 \n";
$mailheaders .= "X-MSMail-Priority: High \n";
$mailheaders .= "X-Mailer: PHP4";
mail($recipient, $subject, $msg, $mailheaders);
if ($use_headers =="0"){
echo "$header";
} else { include ("$header"); }
?>
<h2>Thank You, <?=$name?>. </h2>
<?=$success_message?>
<?
if ($use_footers =="0"){
echo "$footer";
} else { include ("$footer"); }
} else {
if ($use_headers =="0"){
echo "$header";
} else { include ("$header"); }
?>
<h2>Error</h2>
<?=$error_email?>
<?
if ($use_footers =="0"){
echo "$footer";
} else { include ("$footer"); }
} } ?>
Why?
Please take a look at my code. Thank you.
<?php
#
# NL-PHPMail v1.5
# Copyright 2002-2003 Sasha, All rights reserved.
# First released December 11, 2002
# This version released October 6, 2003
#
# NL-PHPMail v1.5 is linkware and can be used or modified as long as this note remains intact
# and unaltered, and there is a link up back to so people know where you got this script. You are forbidden to sell or distribute the code of NL-PHPMail v1.5, in whole
# or part, without the written consent of Sasha.
#
# By using NL-PHPMail v1.5 you agree to indemnify Sasha from any liability.
#
# Website: # FAQ: # Support: #
// -----------------------
//VARIABLES NEEDED FOR THE SCRIPT TO WORK, PLEASE CHANGE THESE AS SPECIFIED
// -----------------------
//Your email address (where the form will be sent):
$recipient = 'smah@shm-design.com';
//The subject of the email:
$subject = 'Ergo4me Form';
//Change this to the URL to your HTML form.
$form_url = '
//If you're using Headers and Footers with PHP, please fill in the path to them below. This can be a relative path (like, header.inc if it's in the same directory), or an absolute path. If you're NOT using headers, please leave this empty.
$header ='';
$footer ='';
//Below is the content of the actual email sent to you. If you have different or more form fields than specified here, copy and paste the below line (without the // in front of it) into the coding bit below. Beneath the Comments line would be a good place for it:
// $msg .= "Field Description: $_POST[field_name]\n";
// Change the description and field name to match the field in your form. The $_POST[field_name] variable is what takes the contents of the form fields, so change "field_name" to the name of your form field. The . in front of the = sign merely means that line will be added to the variable, along with all previous lines, instead of overwriting it, so don't take it out! Use \t to insert a tab, and \n to insert a new line.
$msg = "---------------\n";
$msg .= "$subject\n";
$msg .= "---------------\n\n";
$msg .= "Name: $_POST[name]\n";
$msg .= "Email: $_POST\n";
$msg .= "Phone: $_POST[phone]\n";
$msg .= "Comments: $_POST[comments]\n";
// Change the names below to the 2 required fields in your form. If these fields are not filled out, the script will not send an email and display an error message instead, asking the visitor to fill out the form again.
$req1 ="$name";
$req2 ="$email";
//The below error message will be displayed if not all required fields are filled in. Feel free to use normal HTML in this.
$error_required = '<p>It appears you forgot to enter either Your email address or Your full name.<br />Please press the BACK button in your browser and try again.</p>';
//The below error message will be displayed if the visitor submitted an invalid email address. Feel free to use normal HTML in this.
$error_email = '<p>Oops, it appears that the email address you filled in is not a valid one. Please press the back button on your browser and try again. Please check carefully that you filled in all information in the right fields!</p>';
//The below success message will be displayed when the form is sent. Feel free to use normal HTML in this.
$success_message = '<p>Your Ergo4me form has been sent. An ergo4me presentative will contact you shortly. T </p>';
// -----------------------
//DO NOT EDIT ANYTHING BELOW UNLESS YOU KNOW WHAT YOU'RE DOING!!
// -----------------------
if ($header ==""){
$use_headers ='0';
$header = '<html><head><title>Website Quote Form</title></head><body>';
} else {$use_headers ='1';}
if ($footer ==""){
$use_footers ='0';
$footer = '<div id="content"></div></body></html>';
} else {$use_footers ='1';}
function is_valid_email ($address) {
return (preg_match(
'/^[-!#$%&\'*+\\.\/0-9=?A-Z^_`{|}~]+'.
'@'.
'([-0-9A-Z]+\.)+' .
'([0-9A-Z]){2,4}$/i',
trim($address)));
}
function is_valid_email_eregi ($address) {
return (eregi(
'^[-!#$%&\'*+\\./0-9=?A-Z^_`{|}~]+'.
'@'.
'([-0-9A-Z]+\.)+' .
'([0-9A-Z]){2,4}$',
trim($address)));
}
if (!isset($req1) || !isset($req2) || !isset($req3)) {
header( "Location: $form_url" ); }
elseif (empty($req1) || empty($req2) || empty($req3)) {
if ($use_headers =="0"){
echo "$header";
} else { include ("$header"); }
?>
<h2>Error</h2>
<?=$error_required?>
<?
if ($use_footers =="0"){
echo "$footer";
} else { include ("$footer"); }
}
else {
$f_email = $_POST[email];
$f_email = strtolower(trim($f_email));
if (is_valid_email($f_email)) {
$msg .= "\n\n---------------\n";
$msg .= "Life is good./\n";
$msg .= "---------------\n\n";
$mailheaders = "MIME-Version: 1.0 \n";
$mailheaders .= "Content-type: text/plain; charset=iso-8859-1 \n";
$mailheaders .= "From: \"$_POST[email]\" <$_POST[email]> \n";
$mailheaders .= "Reply-To: \"$_POST[email]\" <$_POST[email]> \n";
$mailheaders .= "X-Priority: 3 \n";
$mailheaders .= "X-MSMail-Priority: High \n";
$mailheaders .= "X-Mailer: PHP4";
mail($recipient, $subject, $msg, $mailheaders);
if ($use_headers =="0"){
echo "$header";
} else { include ("$header"); }
?>
<h2>Thank You, <?=$name?>. </h2>
<?=$success_message?>
<?
if ($use_footers =="0"){
echo "$footer";
} else { include ("$footer"); }
} else {
if ($use_headers =="0"){
echo "$header";
} else { include ("$header"); }
?>
<h2>Error</h2>
<?=$error_email?>
<?
if ($use_footers =="0"){
echo "$footer";
} else { include ("$footer"); }
} } ?>