On Thu, 24 Jun 2004 21:53:21 -0400, Al <[EMAIL PROTECTED]> wrote:
>
> You need to be specific about what you consider to be a legitimate value
> for your application.
>
> consider:
>
> $var= $_GET['myname'];
>
> if((preg_match("/([0-9]|[a-z]|[A-Z]/", $var)) { Do something }
First, you have an extra ( and a missing ).
Second, you don't need to use the or.
if((preg_match("/[0-9a-zA-Z]/", $var)) { Do something }
>
> No spaces and watch the "|" between the ] and the [
>
> If $myname has at least one number or character, there will be a match.
>
> You can put any legit character(s) in []s, just OR them in.
>
>
>
>
> Terence wrote:
>
> > Hi,
> >
> > Say you have a querystring - index.php?myname=joe
> >
> > To determine whether myname has a value I have come to the following
> > conclusions / shortcomings when using one of the following:
> >
> > ISSET = as long as the variable myname exists it's set, but there's no
> > guarantee of a value
> >
> > !EMPTY = if your name = 0 (zero) then it's considered empty, for all
> > else it seems to work
> >
> > STRLEN = I have found this to be the only sure way to know.
> >
> > Is there any other way, or should we always use a combination of ISSET
> > and STRLEN?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> !DSPAM:40db82d0186614274081660!
>
>
--
paperCrane --Justin Patrin--
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php