Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

php + validating a password in a form

  • 19-06-2008 09:36AM
    #1
    Registered Users, Registered Users 2 Posts: 788 ✭✭✭


    Hi there,

    I'm creating a form to register a user, I'd like the user's password to be alphanumeric, and if its not, to display an error message. I can't seem to find any functions that deal with this in a simple way. Anyone have any ideas/suggestions I'd really appreciate it :)


Comments

  • Registered Users, Registered Users 2 Posts: 68,173 ✭✭✭✭seamus


    preg_match() would probably be your man. Have a look at regular expressions.

    The Regex

    /^[A-Za-z0-9]*$/ will match all alphanumeric strings.

    It can also be written as /^[:alnum:]*$/ but for some reason I find the former easier to read.


Advertisement