Lets say I have a POST sending along an unknown number of check box variables, and in the next PHP doc in the submit URL, I want to do somethign with each of those values. I have conveniently used a loop in PHP to create the names of hte check boxes: Check1 - Check8 (but it could later be changed from Check1-CHeck11, but I don't want to have to alter this code).
In the submit.php code, I want to be able to cycle through all of these check boxes. I have a way to loop through the total number of check boxs that were there, but I don't know how to dynamicly create each variable name to test: ie I want to do:
Is Check1 = 1?
Is Check2 = 1?
Is Check3 = 1?
But I cant figure out how to change the 1/2/3 part of the variable name as I go.
Is there anything like:
for ($i=0; $i<checktotal; $i++) {
if ($Check$i ==1)
do something
}
Thanks!
In the submit.php code, I want to be able to cycle through all of these check boxes. I have a way to loop through the total number of check boxs that were there, but I don't know how to dynamicly create each variable name to test: ie I want to do:
Is Check1 = 1?
Is Check2 = 1?
Is Check3 = 1?
But I cant figure out how to change the 1/2/3 part of the variable name as I go.
Is there anything like:
for ($i=0; $i<checktotal; $i++) {
if ($Check$i ==1)
do something
}
Thanks!
Comment