<?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">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Ecrire les notes </title>

<style type="text/css">
<!--
.style1 {
	font-size: 18px;
	font-weight: bold;
}
body,td,th {
	color: #000033;
}
body {
	background-color: #FFF;
}
-->
</style>

<body>

<div>
<form method="post" action="_listenoteparmatiereprof.php">
<?php 
include 'header';
$id=$_SESSION['id'];

include("_serveur.php");
$sql = 'SELECT * FROM teachersSubsubjects  join subSubjects on teachersSubsubjects.subsubjectID=subSubjects.id
                                       	join classes on teachersSubsubjects.classID=classes.id
										join subjects on teachersSubsubjects.subjectID=subjects.id
										join gradesSubjects on gradesSubjects.classID=classes.id and subSubjects.id=gradesSubjects.subSubjectID
									    join classesSemesters on classesSemesters.classID=classes.id
									    join semesters on classesSemesters.semesterID=semesters.id 
									    
	                                    where userID= "'.$id.'"and classesSemesters.teachersActive=1 order by semesters.id,classes.id,subjects.ordering,subSubjects.id';
if(!(mysqli_query($link, $sql))){
    echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
$req=  mysqli_query($link, $sql);
echo '<p>Classes:<select name="cont" class="w3-select w3-border w3-light-grey">';

while ($data = mysqli_fetch_array($req)) {

$classID=$data[7];
$classen=$data[8];
$ctrlID=$data[21];
$ctrl=$data[22];
$subject=$data[11];
$subSubjectID=$data[3];
$matiere=$data[6];

  echo' <option value="'.$classID.";".$ctrlID.";".$subSubjectID.'">'.$classen." - ".$ctrl." - ".$subject." - ".$matiere.'</option>';
	
}
echo '</select>';


echo '<button class="w3-btn w3-blue" name="envoyer">Afficher</button></p>';				   
if (isset ($_POST['envoyer'])){
//On récupère les valeurs entrées par l'utilisateur :
$cont1=$_POST['cont'];
$cellm=explode(";",$cont1);
 $classe1=$cellm[0];
 $ctrl1=$cellm[1];
$subSubjectID=$cellm[2];
 $classen=$cellm[3];
 $ctrln=$cellm[4];
$subject=$cellm[5];
$matiere=$cellm[6];
$_SESSION['classe1']=$classe1;
$_SESSION['ctrl1']=$ctrl1;
$_SESSION['subSubjectID']=$subSubjectID;
$_SESSION['classen']=$classen;
$_SESSION['ctrln']=$ctrln;
$_SESSION['subject']=$subject;
$_SESSION['matiere']=$matiere;

 echo '<META HTTP-EQUIV="Refresh" Content="0; URL=listenotesprof.php">';    
}



?>
</body>
</html>
