Help - Search - Members - Calendar
Full Version: Help verifying that passwords match
HTMLHelp Forums > Programming > Client-side Scripting
tyler.watkins
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.
Darin McGrew
Ultimately, you need to verify that the passwords match in the server-side program that processes the form data (reg3.php).
tyler.watkins
How would I do that? Any idea how the code will look?
Enhanced Software Solutions
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
Darin McGrew
But keep in mind that you need the same check in the PHP, after the data has been submitted to the server.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.