OK, I'm posting a code... here goes:
<?
$itemName = array("",
"Question A",
"Question B",
"Question C",
"Question D",
"Question E",
"Question F",
"Question G",
"Question H",
"Question I",
"Question J");
HERE;
printForm();
evaluate();
postTest();
function printForm(){
global $itemName;
for($i = 1; $i <= 10; $i++) {
print "<b>$i. $itemName[$i] </b>";
print <<<HERE
<input type = "checkbox"
name = "itemNo[$i]"
value = "a">
<br>\n
HERE;
} // end for loop
} // end printForm
function evaluate() {
if($itemNo[$i] == "a"){
$iat[$i] = 1;
} // end if
$score = $i * $iat[$i];
} // end evaluate
and, of course, the postTest function will post the $score value to result.php page... I'm about to write it, and thinking about something like this (I might have messed something up in this one):
function postTest() {
global $score;
print <<<HERE
<input type = "hidden"
name = "hdnSubmit"
value = "$score">
<br><br>
<input type = "submit"
value = "Submit test">
<br><br>
<input type = "reset"
value = "Reset answers">
HERE;
} // end postTest
?>
I tried to "hide" the values by setting the checkbox value as "a", then "recoding" that value to 1 on the score variable. I quess there has to be more efficiant & ellegant way to do this, so, pls, let me know!!
And, yup, "Question A to I" are just here as an example... I certainly do not intend to post the real on forum... Who knows...!?!
