#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Location
    On planet earth
    Posts
    94
    Rep Power
    10

    Validating numbers


    I want to validate numbers only, not alpha numeric, but up to 11 numbers (UK standards), albeit because there are some numbers that are shorter, it would be of various length

    So, how would I go about it?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Sep 2006
    Posts
    2,011
    Rep Power
    534
    I don't understand.

    What is UK standard?

    Do you mean 11 numbers as being 12345678901?

    Shorter numbers?
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Location
    On planet earth
    Posts
    94
    Rep Power
    10
    OK, I've done it with strlen function

    PHP Code:
    if (isset($number) == true && empty($number) == false)
    {     
    if (
    strlen($number) < 10 || strlen($number) > 11)
    {         
    $error_number "Please put a valid phone number"
    But need to validate the actual number to see if it is only a number nothing else, that is what I mean
  6. #4
  7. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,064
    Rep Power
    9398

IMN logo majestic logo threadwatch logo seochat tools logo