<?php
	ob_start();
    session_start();
chdir('../');
	require_once("public/connection.php");
	require_once("public/functions.php");

if (isset($_GET['level'])) {
    $level = mysqli_real_escape_string($connection, $_GET['level']);
    $query = "SELECT id, subject FROM school_subjects_level WHERE level = '{$level}' ORDER BY subject ASC";
    $result = mysqli_query($connection, $query);

    while ($row = mysqli_fetch_assoc($result)) {
        echo "<option value='{$row['id']}'>{$row['subject']}</option>";
    }
}
?>

