<?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="_listeeleveabs.php" name="john">

<?php
include 'header.php';

$studentID=$_GET['studentID'];
$prenom=$_GET['prenom'];
$pere=$_GET['pere'];
$famille=$_GET['famille'];
echo "<a href=\"javascript:history.go(-3)\"><button type='button' >Retourner</button></a>";
echo '<div class="w3-panel w3-blue w3-round-xlarge"><p>'.$studentID.'  '.$prenom.'    '.$pere.'    '.$famille.'</p></div>';
include '_serveur.php';
 echo "<input type='hidden' name='studentID' value='".$studentID."'/>";

echo '<label class="w3-text-teal">Date(début) :</label> <input class="w3-input w3-border w3-pale-blue" type="date" name="date"  />';

echo '<label class="w3-text-teal">Date(fin):</label> <input class="w3-input w3-border w3-pale-blue" type="date" name="date1" value="'.date("Y-m-d").'" />';

  echo ' <button class="w3-btn w3-blue" name="envoyer">Chercher</button></form>';   
if (isset ($_POST['envoyer'])){

//On récupère les valeurs entrées par l'utilisateur :
$date=$_POST['date'];
$date1=$_POST['date1'];
$studentID=$_POST['studentID'];
$sql = 'SELECT * from absences where studentID = "'.$studentID.'"  order by date';
   if(!(mysqli_query($link, $sql))){
    echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
                                  }
$req=  mysqli_query($link, $sql);
$i=0;
$j=1;
$count=1;
echo '<table class="w3-table w3-striped w3-bordered">';
while($data = mysqli_fetch_array($req)) {
	 $studentID=$data['studentID'];
	  $message=$data['message'];
	  $date2=$data['date'];
	  $i=$i+1;
	  echo "<tr><td >".$message."</td><td>".$date2."</td></tr>";
}
echo "<tr><td bgcolor='#A6FDF4'>Nombre Total des jours</td><td>".$i."</td></tr>";
}

?>
</body>
</html>
