Hello, There is multidimensional array which has stored several information about each record. From those 1st is name and 2nd is pswd
I am trying to write a function which would check name and pswd entered by user and check whether name exists in array or not. If it does then check whether pswd matches or no. If it does then let user go to next page else give an error.
I have array and all set. My while loop even works for 1st record in table. If user enters 1st name and wrong pswd, it gives error. If user enters 1st name n pswd for it then it works which it should do. But for any other record it doesnt work even if i put correct information because my while loop dont increment for some reason and doesn't check 2nd record or after that.
Please help me with it.. here's my function code
function Test(formtest)
{
initialize_array(); //this calls the array which is already populated by all data
var errmsg = "Invalid username or password!";
var x = 0;
while (x < arrUser.length)
{
if ((formtest.usrrname.value == arrUser[x][0]) && (formtest.pswd.value == arrUser[x][1])) //[row][column] so it checks whether 1st column and 2nd column values match to what user entered in 1st row then 2nd then 3rd until length of array.. if they match say true
return true;
else
{
alert(errmsg);
return false; //if dont match give error n return false
}
x++; //somehow it dont increment and only checks first row n none after that.. Need Help here!!!
}