Re: Valid Chars Function
| From: | _lallous | Date: | Mon, 19 Nov 2001 08:04:41 +0000 |
| Subject: | Re: Valid Chars Function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-75075@lists.php.net to get a copy of this message | ||
you can use regluar expressions, or single character scanning via for loop,
1)RegExp:
if (ereg('[^a-z0-9]', $name)) print 'error!';
2)For loop
for ($i=0;$i<strlen($name)$;$i++)
if ($name[$i] == '@' || $name[$i]=='!' .. ....) print 'error!';
"Phantom" <phantom@phantomcougar.com> wrote in message
news:3BF8B49C.40F54D45@phantomcougar.com...
> Anyone know a good PHP function or script to scan a string for Valid
> Characters to make sure something that is not allow is not included in a
> form?
>
> $Name = "#@@##@!#!@" would not be a valid alphabetical name, how do I
> scan for that in PHP? Thanks.
>