Hi,
Im using a php script to send form input and validate the input. I have the empty() function working, but cant get the validation of email working. I would ulitmately like to include more fields for zip code, etc. and have these validated accordingly. I tried adding the popular php email validate with an if statement below my first if statement, but it didnt work. Heres the script. Suggestions?
----------------
<?
/*
CHFEEDBACK.PHP Feedback Form PHP Script Ver 2.01.
Generated by thesitewizard.com's Feedback Form Wizard.
Copyright 2000-2003 by Christopher Heng. All rights reserved.
thesitewizard and thefreecountry are trademarks of Christopher Heng.
$Id: phpscript.txt 1.1 2003/04/17 11:53:45 chris Exp $
Get the latest version, free, from:
http://www.thesitewizard.com/wizards/feedbackform.shtml
You can contact me at:
http://www.thesitewizard.com/feedback.php
LICENCE TERMS
1. You may use this script on your website, with or
without modifications, free of charge.
2. You may NOT distribute or republish this script,
whether modified or not. The script is meant for your
personal use on your website, and can only be
distributed by the author, Christopher Heng.
3. THE SCRIPT AND ITS DOCUMENTATION ARE PROVIDED
"AS IS", WITHOUT WARRANTY OF ANY KIND, NOT EVEN THE
IMPLIED WARRANTY OF MECHANTABILITY OR FITNESS FOR A
PARTICULAR PURPOSE. YOU AGREE TO BEAR ALL RISKS AND
LIABILITIES ARISING FROM THE USE OF THE SCRIPT,
ITS DOCUMENTATION AND THE INFORMATION PROVIDED BY THE
SCRIPTS AND THE DOCUMENTATION.
If you cannot agree to any of the above conditions, you
may not use the script.
Although it is NOT required, I would be most grateful
if you could also link to thesitewizard.com at:
http://www.thesitewizard.com/
*/
// ------------- CONFIGURABLE SECTION ------------------------
// $mailto - set to the email address you want the form
// sent to, eg
//$mailto = "youremailaddress@example.com" ;
$mailto = 'jond@tools4flooring.com' ;
// $subject - set to the Subject line of the email, eg
//$subject = "Feedback Form" ;
$subject = "Dealer Registration" ;
// the pages to be displayed, eg
//$formurl = "http://www.example.com/feedback.html" ;
//$errorurl = "http://www.example.com/error.html" ;
//$thankyouurl = "http://www.example.com/thankyou.html" ;
$formurl = "http://www.tools4flooring.com/dealer-registration.asp" ;
$errorurl = "http://www.tools4flooring.com/error.asp" ;
$thankyouurl = "http://www.tools4flooring.com/thankyou.asp" ;
// -------------------- END OF CONFIGURABLE SECTION ---------------
$company = $_POST['company'] ;
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$references = $_POST['references'] ;
$http_referrer = getenv( "HTTP_REFERER" );
if (!isset($_POST['email'])) {
header( "Location: $formurl" );
exit ;
}
// -------- PROBLEM SECTION -----------
if (empty($company) || empty($name) || empty($email) || empty($references)) {
header( "Location: $errorurl" );
exit ;
}
$messageproper =
"This message was sent from:\n" .
"$http_referrer\n\n" .
"--------------- DEALER INFORMATION -------------------\n\n" .
"Company: ".
$company .
"\nContact Name: ".
$name .
"\n\nTrade References:\n".
$references .
"\n\n-----------------------------------------------------------------\n" ;
mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>\nReply-To: \"$name\" <$email>\nX-Mailer: chfeedback.php 2.01" );
header( "Location: $thankyouurl" );
exit ;
?>