[thelist] PHP Form Validation

Andrew Maynes andrew at humanbehaviour.co.uk
Mon Jan 6 14:04:30 CST 2003


the reason I want a validation is because the company will receive a
notification that someone has told a friend.  It would be pretty silly to tell
the compant that someone has clicked the send without putting in their email
addresses in.  I will only get them asking me to make sure the form fields have
to be filled in!

Andrew

-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of shawn allen
Sent: Monday, January 06, 2003 19:57
To: thelist at lists.evolt.org
Subject: Re: [thelist] PHP Form Validation


quoth Hans-Frédéric Fraser:
> On 1/6/03 11:17 AM, "Andrew Maynes" <andrew at humanbehaviour.co.uk> wrote:
> > The tell a friend form needs to validate two email addresses, the
> > sender's and the sender's friend.  At the moment I only have this:
> >
> > /*e-mail´s validity is check with this */
> > if (!eregi ("^[_\\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\\.)+[a-z]{2,4}$",
> > $email)) $error_message = "A valid e-mail address is required.";

I'd recommend you not validate email addresses at all unless you can
properly account for every possible, *valid* variation according to the
RFC[1]. What annoys me about many sites is the use of limited regular
expressions that keep me from entering (perfectly valid) addresses like
'shawn+foo at alterior.net', in which I use the '+foo' to track the
distribution of my address after posting it to a particular website, or
just to simplify procmail recipes on my end.

An alternative solution is to simply have the user verify their address
with a duplicate field. If they can type in an invalid email address
twice in a row, well, they've got problems. IMO, of course ;)

[1] http://www.ietf.org/rfc/rfc2822.txt

--
shawn allen
  mailto://shawn@alterior.net
  phone://415.577.3961
  http://alterior.net
  aim://shawnpallen

--
* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.435 / Virus Database: 244 - Release Date: 30/12/2002




More information about the thelist mailing list