iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-28-2004, 05:23 PM
WebProWorld Member
 
Join Date: May 2004
Posts: 93
jmdb71 RepRank 0
Default php email validation

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 ;

?>
Reply With Quote
  #2 (permalink)  
Old 05-29-2004, 03:11 AM
WebProWorld Veteran
 
Join Date: Apr 2004
Posts: 447
HardCoded RepRank 0
Default

Sorry, don't get it. What's not working?
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 11:44 AM.



Search Engine Optimization by vBSEO 3.3.0