Results 1 to 4 of 4

Thread: numeric only

  1. #1
    Join Date
    Apr 2007
    Posts
    149
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default numeric only

    Hello everyone, i have a contact form which has a phone number field, and i want to make it only number,

    i have used the following code:
    PHP Code:
    if (preg_match('/^[0-9]{1,}$/'$phone) < ) {
            
    $error['phone'] = "Please enter your phone number.";
        } 
    But for some reason, it does not work, can you give me a hand with this?
    Last edited by remp; 11-22-2010 at 04:14 AM.

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Jeremy | jfein.net

  3. The Following User Says Thank You to Nile For This Useful Post:

    remp (11-22-2010)

  4. #3
    Join Date
    Apr 2007
    Posts
    149
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thanks, i had tried that before, and it wasnt working, but i found it the error was in another part of the code. and i have changed it to is numeric...

    Thank again.

  5. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    No problem, I'm glad to help

    Here on DD, we like to keep things organized. In an effort to do so, you have the option to set a thread to resolved when an issue is fixed. To make the status of the thread resolved:
    1. Go to your first post
    2. Edit your first post
    3. Click "Go Advanced"
    4. In the dropdown next to the title, select "RESOLVED"
    Jeremy | jfein.net

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •