You could add is_integer() into the if statement.
On 15 Oct 2004, at 14:07, Robert Cummings wrote:
On Fri, 2004-10-15 at 07:45, Gareth Williams wrote:Do you even need a regex?
What about
if (strlen($_POST['mobile_number']) != 11 && substr($_POST['mobile_number'],0,3) != 447) { $error="Invalid Number"; }
This doesn't verify that the portion following 447 is also a number.
eg. 4474567X901
Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php