<?php
require 'config.php';
$teacher = $_GET['teacher'];
$stmt = $conn->prepare("SELECT DISTINCT term FROM end_term_report WHERE Teacher = ?");
$stmt->bind_param("s", $teacher);
$stmt->execute();
$result = $stmt->get_result();

$terms = [];
while ($row = $result->fetch_assoc()) {
  $terms[] = $row['term'];
}
echo json_encode($terms);
