RE: [PHP] Form validation
| From: | Ralph Guzman | Date: | Thu, 02 Nov 2000 05:15:09 +0000 |
| Subject: | RE: [PHP] Form validation | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-23316@lists.php.net to get a copy of this message | ||
assuming the text input field is $text_field, you can try something like
this:
if (strspn($text_field,"0123456789-()") != strlen($text_field)) {
$error = "Illegal Character in Text Field";
} else {
...whatever...
}
-----Original Message-----
From: Shane McBride [mailto:php@riversidedesigns.net]
Sent: Wednesday, November 01, 2000 6:03 AM
To: Php-General
Subject: [PHP] Form validation
I think I saw this answered before, or maybe in an archive somewhere, but I
can not find it. I aplogize for repetition.
How can I take the value of a text input field on a form and make sure it
only contains...say numbers, parenthesis, and hyphens if the field was for a
phone number?
I think it used eregi... Sorry for my ignorance here. :)
Shane