Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Client-side Scripting _ Help verifying that passwords match

Posted by: tyler.watkins Apr 9 2012, 06:28 PM

I am working on a website and I am trying to make a registration page and a members login. I am fairly new to coding and I really enjoy it. The question i have now is how do i verify that both passwords match on the registration page. Like when they go to sign up, the password and the confirm password fields match.

the page I am having the trouble on is: http://blocks.netne.net/register.html

Also please have a look around the site and see if you have any suggestions for me.

I realize that my coding might not be the best.

Also if you have any suggestions or if you could help me with setting up the whole login system, please reply or pm me.

Thanks in advance!!!

PS I am not really sure if this is the right place for this topic.

Posted by: Darin McGrew Apr 9 2012, 07:10 PM

Ultimately, you need to verify that the passwords match in the server-side program that processes the form data (reg3.php).

Posted by: tyler.watkins Apr 9 2012, 07:56 PM

How would I do that? Any idea how the code will look?

Posted by: Enhanced Software Solutions May 8 2012, 04:31 AM

QUOTE(tyler.watkins @ Apr 9 2012, 07:56 PM) *

How would I do that? Any idea how the code will look?


U can use the following java script function for comparing password and confirm password

CODE

<script type="text/javascript" language="JavaScript">

function checkPassword(theForm)
{
    if (theForm.password.value != theForm.verify.value)
    {
        alert('Passwords are not same');
        document.getElementById("verify").focus();
        return false;
    } else {
        return true;
    }
}

</script>

And call this javascript function on submit
<form action="../" onsubmit="return checkPassword(this);">


</form>


Hope this will help you. smile.gif

Posted by: Darin McGrew May 8 2012, 11:37 AM

But keep in mind that you need the same check in the PHP, after the data has been submitted to the server.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)