Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 3 of 3

Thread: [Help] PHP

  1. #1
    Join Date
    Jan 2007
    Location
    Wales
    Posts
    2,432
    Tokens
    141

    Latest Awards:

    Default [Help] PHP

    Hey, I'm making a register form, and I don't want the user's first name or last name to be able to contain numbers. How can I make it check if they've entered numbers in a field using PHP? Any help +rep if I can. I've used Google, no joy, so please don't just say use Google.

    Thanks,
    Vince.
    Free Online Games And Videos:
    http://www.vincesgames.com



  2. #2
    Join Date
    Jul 2007
    Location
    Scotland
    Posts
    529
    Tokens
    0

    Default

    Just using a preg_match on the string should do the trick.

    PHP Code:
    <?php
    if(preg_match('/[0-9]/'$string)) {

        echo 
    'error message here';
        
    }
    ?>

  3. #3
    Join Date
    Jan 2007
    Location
    Wales
    Posts
    2,432
    Tokens
    141

    Latest Awards:

    Default

    Quote Originally Posted by RichardKnox View Post
    Just using a preg_match on the string should do the trick.

    PHP Code:
    <?php
    if(preg_match('/[0-9]/'$string)) {

        echo 
    'error message here';
        
    }
    ?>
    That works perfectly, thanks a lot! +Rep.
    Free Online Games And Videos:
    http://www.vincesgames.com



Posting Permissions

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