<!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>Liste Elèves </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>
<form method="post" action="inscriptione.php" class="w3-container">
<fieldset>
<?php
include 'header.php';
echo '<table with="90%"  align="left"><tr><td>';
echo "Classe :";
include '_serveur.php';
$sql = 'SELECT * from classes 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'<select name="cont" class="w3-select w3-border w3-light-grey">';
echo' <option value="">--Taper ici pour selectionner--</option>';
 while($data = mysqli_fetch_array($req)) {
$classe=$data['name'];
$classeid=$data['id'];
$classe=strtoupper($classe);
  echo' <option value="'.$classeid.";".$classe.'">'.$classe.'</option>';
        };
?>
</select>
</td>
<td><label>Date: <input class="w3-input w3-border w3-light-grey"type="date" name="date1" value="<?php echo date('Y-m-d'); ?>" /></label>
</td>
<tr><td colspan="2">
 <input class="w3-btn w3-blue w3-round-medium" type="reset" value="Effacer" /> 
&nbsp;&nbsp;<input class="w3-btn w3-blue w3-round-medium" type="submit" name="envoyer" value="Envoyer" /> ←
&nbsp;&nbsp;<input class="w3-btn w3-blue w3-round-medium" type="submit" name="quitter" value="Quitter" /> ←
<p>&nbsp;</p>
</td></tr>
</table>
</fieldset>

</form>

<?php
if (isset ($_POST['envoyer'])){
	$cont1=$_POST['cont'];
$cellm=explode(";",$cont1);
 $classeid=$cellm[0];
 $classe1=$cellm[1];

//On récupère les valeurs entrées par l'utilisateur :
$date1 = $_POST['date1'];

echo '<div class="w3-padding-32 w3-green w3-circle">
  <div class="w3-padding-32 w3-red w3-circle w3-center" style="width:55%">
    <p class="w3-xlarge">'.$classe1.'&ensp;'.$date1.'</p>
  </div>
</div>';
$sql = 'SELECT * FROM students  JOIN users on  users.id= students.userID where classID="'.$classeid.'" Order by students.firstName, students.lastName,users.firstName ASC';

   if(!(mysqli_query($link, $sql))){
    echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
$req=  mysqli_query($link, $sql);
$i=1; $num=1;
echo "<table width='95%' border=1 bordercolor='#666666' cellspacing='0'>"; 
while ($data = mysqli_fetch_array($req)) {
   
       echo "<tr>";
         echo '<td width="30%"><a href="_inscriptione.php?studentID='.$data[0].'&userID='.$data[1].'&first='.$data['2'].'&father='.$data['8'].'&last='.$data['3'].'&user='.$data['7'].'&pass='.$data['10'].'">'.$num.' '.$data['2'].' '.$data['8'].' '.$data['3'].'</a></td><td>&nbsp;&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>
		 <td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td></tr>';
		
     $i=$i+1;
	 $num++;    
	  
	    }


}
 
   


?>
</body>
</html>
