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

Options
  • 19-06-2008 9:36am
    #1
    Registered Users 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 Posts: 68,317 ✭✭✭✭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