I'm posting 20 usernames and 20 passwords, they're named username1 ... username20 and then password1 ... password20. In the page that processes the posted values I have an array like this:
$postArray = array(
***
* other values in array
***
$userName1 = $_POST['userName1'];
$password1 = $_POST['password1'];
*
*
$userName20 = $_POST['userName20'];
$password20 = $_POST['password20'];
);
Is there some way I can do a loop that would put each username/password into the array rather than having to type out each one individually? For example, I can do this outside of the array assignment block:
for ($i = 1; $i < 21; $i++) {
$userName[$i] = $_POST['userName' . $i];
$password[$i] = $_POST['password' . $i];
}
but I don't know how to get that to work inside the array assignment block.