Hi All,

here's a part of my JS code which supposed to get some elements by id and my first problem is how to declare the variables inside the loop (num_of_users is a variable)
Code:
num_of_users = encodeURI(document.getElementById('num_of_users').value);
	for (var i=2;i<=num_of_users;i++)
	{
		username_2 = encodeURI(document.getElementById('username_2').checked);
                username_3 = encodeURI(document.getElementById('username_3').checked);
                username_4 = encodeURI(document.getElementById('username_4').checked);
                //.
                //. and so on until num_of_users
	}
My second question is HOW to pass these variables through :
Code:
http.open('get', '../ajax/insert.php?num_of_users='+num_of_users+'&username_2='+username_2+'&username_3='+username_3+'&username_4='+username_4);
Is it possible to pass an array? Did someone have a similar issue? Any suggestion will be highly appreciated!
P.S. How to format the code to be JS - like [ php ] for php?