RE: [PHP] Form validation
| From: | Chris W. Parker | Date: | Wed, 21 Jan 2004 19:32:36 +0000 |
| Subject: | RE: [PHP] Form validation | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-175327@lists.php.net to get a copy of this message | ||
Alex Hogan <mailto:Alex.Hogan@AlliedElec.com>
on Wednesday, January 21, 2004 7:18 AM said:
> Can some one point me in the right direction for a good tutorial on
> form validation in PHP?
Here is a basic practical application.
<?php
// gather and validate data
$fname = (preg_match("/[a-zA-Z-\.\s]{2,25}/", $_GET['fname'])) ?
$_GET['fname'] : 0 ;
$zip = (preg_match("/[0-9]{5}/", $_GET['zip'])) ?
$_GET['zip'] : 0 ;
?>
Chris.