Hi, I have a form with several MySQL records represented on it, with checkboxes.
The checkboxes are created dynamically, and are named something like 'check0', 'check1' etc. as the code loops through a result set.
My question is how to read the values of these checkboxes when the form is submitted. At the moment, I have an array as follows:
$checkBoxes=array($check0, $check1, $check2 etc etc);
I can then read the value of the checkbox on the form through the appropriate array element.
This does what I want, but not efficiently, since I have had to delare over 200 elements, and there could feasibly be more records than this to check.
So, my question is, is there a way of creating this array dynamically, so that it contains the same number of elements as there are checkboxes on the form, <i>and so that the elements contain the values of those checkboxes.</i>
I have tried to do this through something like:
for ($i=0; $i<$num; $i++) {
$acc[$i]='$check'.$i.'';
}
but then the array just contains the values $check0, $check1 etc, rather than the values of the checkboxes, ie. 1, 0, 1, 0 etc.
I would really appreciate any help on this, thanks, Ben