I know it's been forever since this thread has been used, but I just stumbled across it in search of the same capability (a variable number of checkboxes) and wanted to post my results in detail since this pointed me in the right direction.
In my test html form, I made these checkbox fields (with the tags using ( and ) just in case this board strips html tags):
(form action='checkbox.php' method='post')
(input type='checkbox' name='field[1]' value='on') Field 1(br)
(input type='checkbox' name='field[2]' value='on') Field 2(br)
(input type='checkbox' name='field[3]' value='on') Field 3(br)
(input type='checkbox' name='field[4]' value='on') Field 4(br)
(input type='checkbox' name='field[5]' value='on') Field 5(br)
(input type='checkbox' name='field[6]' value='on') Field 6(br)
(input type='submit' value='Submit')
(/form)
My php file (checkbox.php) contained this:
echo "(html)(head)(/head)(body)";
$count=1;
while ($count < 7) {
echo "$count = $field$count";
$count++;
}
echo "(/body)
(/html)";
Worked like a charm! Thanks again for the info in this thread - I thought it would be much harder than it actually was.
Cheers,
John