<?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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Reserver Matières</title>
<link rel="stylesheet" href="w3.css">
<!--<script src="https://sscc-bikfaya.com/Mob_app/tinymce/js/tinymce/tinymce.min.js" referrerpolicy="origin"></script> 
  
<script>tinymce.init({selector:'textarea'});</script> -->
</head>
<style>
body {width:90%;}
</style>
<body>

<div class="w3-card-4">
<form method="post" action="teacherreservetlist.php" >
<?php
include 'header.php';
$classeid=0;
$date=$agenda="";
$ctrlErr="";
$id=$_SESSION['id'];

//include("_serveur.php");
//include("_serveur.php");
$cycle=$_GET['cycle'];
include '_serveur.php';
$sql = 'SELECT * from users where users.id="'.$id.'" order by firstName,lastName ASC';
   if(!(mysqli_query($link, $sql))){
    echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
$req=  mysqli_query($link, $sql);
echo '<p><label class="w3-text-teal" >Nom:</label>';
echo '<select name="nomid" class="w3-select w3-border w3-light-grey">';

 while($data = mysqli_fetch_array($req)) {
$firstName=$data['firstName'];
$lastName=$data['lastName'];
$userID=$data['id'];
$classe=strtoupper($classe);

 echo' <option value="'.$userID.';'.$firstName.';'.$lastName.'">'.$firstName.'-'.$lastName.'</option>';
        };



 echo' </p><p> <input name="envoyer" type="submit" class="style19" value="Envoyer" bgcolor="#CC99FF" /></p></form></div>';
               
if (isset ($_POST['envoyer'])){
$nomid=array();
$nomid=$_POST['nomid'];
$nomid1=array();
$nomid1=explode(";",$nomid);
$id=$nomid1[0];
$fisrtName=$nomid1[1];
$lastName=$nomid1[2];
$sql = 'SELECT * from teachersSubjects join subjects on teachersSubjects.subjectID=subjects.id
                                      join classes on  teachersSubjects.classID=classes.id where teachersSubjects.userID="'.$id.'"';
   if(!(mysqli_query($link, $sql))){
    echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
$req=  mysqli_query($link, $sql);
echo '<p><label class="w3-text-teal" >Nom:'.$fisrtName."&nbsp;&nbsp;".$lastName."</label><br>";

 while($data = mysqli_fetch_array($req)) {
	 $userid=$data[0];
	 $classid=$data[1];
	 $subjectid=$data[2];
	  $subsubjectid=$data[3];
	 $subsubject=$data[6];
	 $classe=$data[8];
	 echo '<tr><td><a href="deletereservelist.php?userid='.$userid.'&classid='.$classid.'&subjectid='.$subsubjectid.'" ><img src="delete.png" height="50px" width="50px"></a></td></tr>';

	 echo $classe."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$subsubject."<br>";
 }
 
 


 
}
//On se connecte
// on ferme la connexion

?>


</body>
</html>