Well, one quick thought...
This is based on the assumption that I understand correctly that you want to serialize checked boxes across multiple pages before submitting to the compare function?
The problem is that checkboxes simply do not show up in the POST header when they are unchecked (i.e. a text input will show up as 'name=' at least so you can at least validate nothing was entered.)
My original thought was to store the checkbox array in the user session. However, because of the aforementioned fact, you would have no reliable way to uncheck boxes.
You'll probably have to resort to storing checks in a database table such as:
CREATE TABLE `studentchecks` (
`id` INT UNSIGNED NOT NULL ,
`sessionid` VARCHAR( 128 ) NOT NULL
`page` INT UNSIGNED NOT NULL ,
PRIMARY KEY ( `id` , `sessionid` )
)
Then you could record each check by something like...
foreach ($_POST['istudent'] as $studentid) {
$sql = "INSERT INTO `studentchecks` ( `id` , `sessionid` , `page` )VALUES ('$studentid', '" . session_id() . "', '$pageid') ON DUPLICATE KEY `page` = `page`";
}
and right after run...
$sql = "DELETE FROM `studentchecks` WHERE `id` NOT IN (" . implode(",", $_POST['istudent']) . ") AND `sessionid` = '" . session_id() . "' AND `page` = '$pageid'";
to clean up anything you didn't check.
This is untested and just a concept that may get you started or give you additional insight.