How to provide password validation in php form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shwethatj
    New Member
    • Sep 2008
    • 13

    #1

    How to provide password validation in php form

    My problem is lik this ,

    I am trying to create a PHP registration form for a HR website , but i dont know how provide password validation i.e the password and confirmation password entered by the user should match ...

    Can anyone help me ....

    Regards,
    Shwetha
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    do you have a database?

    If not, just create an array with the user name and passwords stored. Once they submit the information check it against this or the database.

    If its valid, view the form, if not display an error page.

    Comment

    • Atli
      Recognized Expert Expert
      • Nov 2006
      • 5062

      #3
      It could be as simple as:
      [code=php]
      if($_POST['password'] != $_POST['confirmPasswor d']) {
      echo "Your passwords didn't match. Try again.";
      }
      else {
      // Process the rest of the form
      }
      [/code]
      Or am I misunderstandin g you?

      Comment

      • shwethatj
        New Member
        • Sep 2008
        • 13

        #4
        Originally posted by Atli
        It could be as simple as:
        [code=php]
        if($_POST['password'] != $_POST['confirmPasswor d']) {
        echo "Your passwords didn't match. Try again.";
        }
        else {
        // Process the rest of the form
        }
        [/code]
        Or am I misunderstandin g you?
        Hi,
        Thanks for the reply:) ... It works ..

        Regards,
        Shwetha

        Comment

        Working...