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

    Join Date
    Nov 2012
    Posts
    87
    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 Intermediate (1500 - 1999 posts)

    Join Date
    Sep 2006
    Posts
    1,810
    Rep Power
    529
    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
    Posts
    87
    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. Come play with me!
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,760
    Rep Power
    9397

IMN logo majestic logo threadwatch logo seochat tools logo