<?php
require_once('operations.php');
$db = new Operations();
if(isset($_POST["class1"])){

    $class = $_POST["class1"];
    $subject_id = $_POST["subject_id"];
if(!empty($class) && !empty($subject_id)) {

   $statement = $db->findTopicBySubjectIDandClass($subject_id,$class); 

    echo  '<label class="form-control-label" for="input-username">Topic</label>';
                  echo       '<select class="form-control" id =  name = "topic" required>';
                  echo '<option></option>';
                  while ($row = $statement->fetch(PDO::FETCH_ASSOC)){
                    extract($row);    
                  
  echo "<option value = ".$row['id'].">".$row['title']."</option>";
                  };
echo '</select>';
                }
}
?>

