<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>notes</title>
</head>

<body>
<form method='post' action='listenotesprof.php' >
<button type="button"  onclick="window.location.href='_listenoteparmatiereprof.php'">Retourner</button>

<?php
include("_serveur.php");
include 'header.php';

$classe1=$_SESSION['classe1'];
$controle1=$_SESSION['ctrl1'];
$subSubjectID1=$_SESSION['subSubjectID'];
$classen=$_SESSION['classen'];
$ctrln=$_SESSION['ctrln'];
$subject=$_SESSION['subject'];
$matiere=$_SESSION['matiere'];


$sql1 = 'SELECT * from grades join gradesSubjects on gradesSubjects.classID= grades.classID and gradesSubjects.subSubjectID=grades.subSubjectID
                              join students on grades.studentID=students.id and grades.classID=students.ClassID
							  join users on users.id=students.userid
 where grades.classID = "'.$classe1.'" and grades.semesterID="'.$controle1.'" and grades.subSubjectID = "'.$subSubjectID1.'"
 order by students.firstName,students.lastName,users.firstName';
   if(!(mysqli_query($link, $sql1))){
    echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
$req1=  mysqli_query($link, $sql1);
echo '<div class="w3-panel w3-blue w3-card-4">
  <p>'.$classen.'<pre>'.$subject.'<pre>'.$matiere.'</p></div>';
echo '<table class="w3-table w3-striped w3-bordered" align="center">';
	 echo "<tr><th><strong>Numéro</th></strong><th><strong>Prénom&emsp;Père&emsp;Famille</strong> </th>
	 <th>Notes</th><th>Coefficient</th></tr>";

$i=0;
 while($data1 = mysqli_fetch_array($req1)) {
          $grade=$data1[5];
		  $coef=$data1[8];
		  $firstName=$data1[12];
		  $lastName=$data1[13];
		  $middleName=$data1[17];
          
	 $num=$i+1;
	 echo "<tr><td><strong>".$num."</td></strong><td><strong>".$firstName."&emsp;".$middleName."&emsp;".$lastName."</strong> </td>";;
echo "<td>".$grade."</td>";
 echo "<td>".$coef."</td></tr>";
   $i=$i+1;

 }
echo '</table>'; 

?>

 
</body>
</html>