> Here is my rendition of what I think you are looking for.
>
> $str = 'tab( )/space( )/[EMAIL PROTECTED]&*();:...';
>
> if ( preg_match('|[EMAIL PROTECTED]&*();:_.\\\\ /\t-]+$|', $str) ) {
> echo 'success';
> } else {
> echo 'failure';
> }
>
Here is the problem, and it is strange. If I enter each of the above
characters into my form one at a time and hit submit after each one, NO
error is produced for any of them.
If I cut and past this all at once: [EMAIL PROTECTED]&*();:_.\ then an error
IS returned.
If I continue to remove one character at a time, submitting the form each
time, errors ARE still produced.
This is the code in a nutshell:
If(isset($submit)) {
$name = stripslashes($_POST['name']); >> I have tried this with and
without
$formerror = array(); unset($result); >> I have tried this with and
without
if($result = ValidateString($name)) { $formerror['name'] =
$invalidcharacters;
Function ValidateString($string) {
if (!preg_match('|[EMAIL PROTECTED]&*();:_.\\\\ /\t-]+$|',
$string) ) {
return invalidchars;
}
}
}
<Form Stuff>
<input name="name" size="30" type="text">
</form>
Thanks
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php