<?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>
<link rel="stylesheet" href="w3.css">

<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="_effacernoteparmatiere.php" name="john">
<?php
include 'header.php';
$classeid=$subjectId=0;
$coef=$ordre=0;
$classeErr=$subSubjectErr=$coefErr=$ordreErr="";
//include("_serveur.php");
//include("_serveur.php");
$classeid=$_GET['classeid'];
$classe=$_GET['classe'];
include '_serveur.php';?>
<input name="classe" type="hidden" value="<?php $classe=$_REQUEST['classe']; echo $classe; ?>">
<input name="classeid" type="hidden" value="<?php $classeid=$_REQUEST['classeid']; echo $classeid; ?>">

<?php
$sql = 'SELECT Distinct semesters.id,semesters.name from semesters  inner join classesSemesters on semesters.id=classesSemesters.semesterID where classID="'.$classeid.'" order by id ASC';
   if(!(mysqli_query($link, $sql))){
    echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
$req=  mysqli_query($link, $sql);
echo '<label class="w3-text-teal" >Contrôle:</label><select name="ctr" class="w3-select w3-border w3-light-grey">';

 while($data = mysqli_fetch_array($req)) {
$semester=$data['1'];
$semesterid=$data['0'];
 echo' <option value="'.$semesterid.";".$semester.'">'.$semester.'</option>';
        };

echo '</select>';

$sql1 = 'SELECT * from subSubjects JOIN subjects on subjects.id=subSubjects.subjectID
                                    join gradesSubjects on subSubjects.id=gradesSubjects.subSubjectID
									join classes on gradesSubjects.classID=classes.id where classes.id="'.$classeid.'" order by subjects.id, subSubjects.id ';
   if(!(mysqli_query($link, $sql1))){
    echo "ERROR: Could not able to execute $sql1. " . mysqli_error($link); 
	}
$req1=  mysqli_query($link, $sql1);
echo 'Matière:<select name="sub" class="w3-select w3-border w3-light-grey">';

 while($data1 = mysqli_fetch_array($req1)) {
$subject=$data1[4]; 
$matiere=$data1[2];
$subSubjectID=$data1[0];
 echo '<option value="'.$subSubjectID.'">'.$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 :
$ctrl1=$_POST['ctr'];
$subSubjectID=$_POST['sub'];
$classe=$_POST['classe'];
$classeid=$_POST['classeid'];
$_SESSION['ctrl1']=$ctrl1;
$_SESSION['subSubjectID']=$subSubjectID;
$_SESSION['classeid']=$classeid;
$_SESSION['classe']=$classe;

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

?>
</body>
</html>
