Re: simple form validation
| From: | Pavel Jartsev | Date: | Thu, 26 Apr 2001 14:56:19 +0000 |
| Subject: | Re: simple form validation | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-50467@lists.php.net to get a copy of this message | ||
Jamie Saunders wrote:
>
> ...
>
> Right, you still with me? What I'd like to know is how to validate a text
> field in an HTML form to make sure it only contains numbers.
>
> ...
>
Try this:
<?
$phone_nr = '54256009';
if ( ereg( '^[0-9]+$', $phone_nr ))
...ok...
else
...not ok...
?>
Hope this helps.
--
Pavel a.k.a. Papi