<?php
if(!isset($_SERVER['HTTP_REFERER'])){
    // redirect them to your desired location
    header('location:../index.php');
    exit;
}
?>
<?php 
include_once('../controller/config.php');

?>
<?php
//fetch.php
if(isset($_POST["action"]))
{
	
	
	
	
 $output = '';
 if($_POST["action"] == "grade")
 {
   $query = "SELECT * FROM modules 
   where   anneeId = '".$_POST["query"]."' ORDER BY Designation ASC";    
  $result = mysqli_query($conn, $query);
  
  $output .= '<option value="">Sélectionnez le module....</option>';
  while($row = mysqli_fetch_array($result))
  {
   $output .= '<option value="'.$row["moduleId"].'">'.$row["Designation"].'</option>';
  }
 }
 
 if($_POST["action"] == "grade1")
 {
   $query = "SELECT * FROM modules 
   where   anneeId = '".$_POST["query"]."' ORDER BY Designation ASC";    
  $result = mysqli_query($conn, $query);
  
  $output .= '<option value="">Sélectionnez le module....</option>';
  while($row = mysqli_fetch_array($result))
  {
   $output .= '<option value="'.$row["moduleId"].'">'.$row["Designation"].'</option>';
  }
 }
 
 

 
 echo $output;
}


?>
