<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-us">
   <head>
   <title></title>
   <link rel="stylesheet" type="text/css" href="main.css" />
   <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
   <meta http-equiv="content-script-type" content="text/javascript"/>
   </head>
   <body>
   <table>
   <?php
$assignments['a']['title']='websiteassessment';
$assignments['a']['weight']=2;
$assignments['q1']['title']='quiz 1';
$assignments['q1']['weight']=1;
$assignments['q2']['title']='quiz 2';
$assignments['q2']['weight']=1;
$assignments['q3']['title']='quiz 3';
$assignments['q3']['weight']=1;

$students[0]['name']='Hildegard von Bingen';
$students[0]['assessment']['a']=4;
$students[0]['assessment']['q1']=2;
$students[0]['assessment']['q2']=3;
$students[0]['assessment']['q3']=4;

$students[1]['name']='Jeanne d\'Arc';
$students[1]['assessment']['a']=3.4;
$students[1]['assessment']['q1']=3;
$students[1]['assessment']['q2']=3;
$students[1]['assessment']['q3']=2.5;

// find the sum of assignement weights
$total_assignment_weight=0;
foreach($assignments as $assignment)  {
  $total_assignment_weight=$total_assignment_weight+$assignment['weight'];
}
foreach($students as $student) {
  $student_name=$student['name'];
  $total_for_student=0;
  foreach($assignments as $code => $assignment ) {
    $weight=$assignment['weight'];
    // result of the assesment
    $result=$student['assessment'][$code];
    if(! isset($result)) {
      print "FATAL: no result for assessment $code for $student_name\n";
      last;
    }
    $total_for_student+=$result*$weight; 
  }
  $average=$total_for_student/$total_assignment_weight;
  print "<tr><td>$student_name</td>";
  print "<td>$average</td></tr>\n";
}
?>
</table>
    <p id="validator">
      <a href="http://validator.w3.org/check?uri=referer">
        <img style="border-width: 0pt" alt="Valid XHTML 1.0!" height="31"
             width="88" src="http://dlib.info/valid-xhtml10.png"/>
      </a>
    </p>
  </body>
</html>

Valid XHTML 1.0!