Javascript login code additional feature?
<p>Hi guys this might be a simple one, but then again i'm a little simple occassionaly.</p>

<p>I have a login box using a simple javascript login comparing usernames and passwords, before you all start I know about the security issues in using javascript for authentication. Here is the code</p>

<pre><code>function validate() {
    var un = document.getElementById("usern").value;
    var pw = document.getElementById("pword").value;
    var valid = false;

    var unArray = ["markwalt", "jongossy", "lisacain", "jenndemp"];
    var pwArray = ["mark1234", "flomaygo", "lisa1234", "jenny1234"];
    var fnArray = ["Mark Walters, Jonathan Goss, Lisa Cain, Jenny Dempsey"];

    for (var i=0; i &lt;unArray.length; i++) {
        if ((un == unArray[i]) &amp;&amp; (pw == pwArray[i])) {
            valid = true;
            break;
        }
    }

    if (valid) {
        alert ("Login was successful");
        document.getElementById("mandatory1").value = un;
    }
    else {
        alert("Invalid Username and/or Password! Please try again. You will not be able to submit this form without a successful login")
        document.getElementById("pword").value = "";
        document.getElementById("usern").value = "";
        document.getElementById("usern").focus();
    }
}
</code></pre>

<p>The issue i have is that at the moment if the login is succesful im posting the username to a hidden field which is then being used by a piece of a software. My question is how do i associate the names in fnArray with the other correct username &amp; password so that i can then grab associated full name and post that to the hidden field "mandator1" instead?</p>

<p>Thanks in advance</p>
