Well, you can make good use of regular expressions, or write your own function.
(It turns out i needed the functions, so I just wrote them, and included
them here)
******************************************************
//This regex checks for > 1 letters in a string - anything else will fail
if(ereg('^[a-z|A-Z]+$', $sName))
echo 'Valid';
else
echo 'Invalid';
******************************************************
//Returns TRUE if all characters in sString are found in sValidChars
function ValidChars($sValidChars, $sString)
{
$len = strlen($sString);
for($i=0; $i<$len; $i++)
if(strpos($sValidChars,$sString[$i])===FALSE)
return FALSE;
return TRUE;
}
******************************************************
//Returns TRUE if none characters in sString are found in sValidChars
function InvalidChars($sValidChars, $sString)
{
$len = strlen($sString);
for($i=0; $i<$len; $i++)
if(strpos($sValidChars,$sString[$i]))
return FALSE;
return TRUE;
}
******************************************************
-Jason Garber
IonZoft.com
At 01:28 AM 11/19/2001 -0600, phantom wrote:
>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.
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]