<?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">
<title>Ecrire Notifications </title>
<link rel="stylesheet" href="w3.css">
</head>
<body>
<form method="post" action="_ecrirenotification.php" class="w3-container">
<?php
 include 'header.php';
$classeid=0;
$date=$agenda="";
$ctrlErr="";
echo "<table width=100% border='0'>";
include '_serveur.php';
$cycle=$_GET['cycle'];
?>
<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 "<tr><td>";

 while($data = mysqli_fetch_array($req)) {
$classe=$data['name'];
$classeid=$data['id'];
$classe=strtoupper($classe);
// echo' <option value="'.$classeid.'">'.$classe.'</option>';
  echo' <input class="w3-check" type="checkbox" name="cla[]" 
   value="'.$classeid.'"><label>'.$classe.'</label>';
       };

?>
</td></tr>
<tr><td>Titre:<input class="w3-input" type="text" name="title" value="" />
</td></tr>
<tr><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>
<tr>
    <td width="100%" scope="row"><textarea class="w3-textarea" name="message" id="message" cols="50" rows="20" > 
                                 </textarea></td>
  </tr>
  
</table>

<?php
 echo' </p><p> <input name="envoyer" type="submit" class="style19" value="Envoyer" bgcolor="#CC99FF" /></p></form>';
               
if (isset ($_POST['envoyer'])){
$cla1=array();
$cla1=$_POST['cla'];
$title=$_POST['title'];
$message=$_POST['message'];
$date1=$_POST['date1'];
$_SESSION['cla1']=$cla1;
$_SESSION['title']=$title;
$_SESSION['message']=$message;
$_SESSION['date1']=$date1;
 echo '<META HTTP-EQUIV="Refresh" Content="0; URL=continuernotifications.php">';    

}

?>




</body>
</html>