Posted by SquishedOrange on 12/07/06 17:45
Jerim79 wrote:
> SquishedOrange wrote:
> > Untested!!!
> >
> > $Zip=stripslashes($_POST["Zip"]);
> >
> > if (empty($Zip)) {
> > $msg7="Please input a 5 digit zip code)";
> > $error++;
> > }
> >
> > if(!preg_match("/^[0-9]+$/ ",$Zip)){
> > $msg7="Please input a valid 5 digit zip code. (No letters or special
> > characters.)";
> > $error++;
> > }
> >
> >
> >
> > :)
>
> Shortly after posting this I was able to find empty. It works like a
> charm. Thanks.
No problem. Note the change to your regular expression in the
preg_match line though.
Your old one won't work exactly as you intended and will match strings
that are only letters. Only by using a couple of "!" did it appear to
work correctly.
Navigation:
[Reply to this message]
|