$value){ if(!empty($value)){ $sum = $sum + $value; $n = $n + 1; } } $average = "Error. There were not enough cases to compute an average."; if($n > 0){ $average = $sum/$n; $average = round($average,2); } return $average; } // Create the form. Pass forward hidden variables. $nextpass = $pass + 1; print "
"; print "
"; print "
"; print "
"; print "
"; print "
"; print ""; print " "; print "
"; // Call the function if pass > 1 if($pass > 1){ $scores = array($v01,$v02,$v03,$v04,$v05); $results = average_scores($scores); print "
"; print_r($scores); print "

Here is the result from averaging the array of scores printed above: $results

"; print "
"; } ?>