<?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 name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="w3.css">
<title>Affiche Agenda</title>
 
</head>
<style>
body {width:90%;}
</style>
<body>

<div class="w3-card-4">
<form method="post" action="_modifieragenda.php" >
<?php
include 'header.php';

$cycle=$_GET['cycle'];
include '_serveur.php';?>
<input name="cycle" type="hidden" value="<?php $cycle=$_REQUEST['cycle']; echo $cycle; ?>">
<?php
$sql = 'SELECT * from classes where cycleID="'.$cycle.'" 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" >Classe:</label><select name="cla" class="w3-select w3-border w3-light-grey">';

 while($data = mysqli_fetch_array($req)) {
$classe=$data['name'];
$classeid=$data['id'];
$classe=strtoupper($classe);
 echo' <option value="'.$classeid.'">'.$classe.'</option>';
        };

echo '</select>';

$sql = 'SELECT * from subjects';
   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">Matière:</label><select name="sub" class="w3-select w3-border w3-pale-blue">';
 while($data = mysqli_fetch_array($req)) {
$matiere=$data['name'];
$subjectID=$data['id'];
 echo' <option value="'.$subjectID.'">'.$matiere.'</option>';
        };

echo '</select>';

echo '</select><label class="w3-text-teal">Date:</label> <input class="w3-input w3-border w3-light-grey" type="date" name="date" value="'.date("Y-m-d").'" />';
                    
 echo'  <input name="chercher"  class="w3-input w3-border w3-light-grey" type="submit" class="style19" value="Chercher" bgcolor="#CC99FF" /></form></div>';
                    
               
if (isset ($_POST['chercher'])){
$classeid=$_POST['cla'];
 $subjectId=$_POST['sub'];
$date=$_POST['date'];	
 $_SESSION['classeid']=$classeid;
$_SESSION['subjectId']=$subjectId;
$_SESSION['date']=$date;
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=continuemod.php">';    

}
?>
</body>
</html>