<?php
include 'includes/database.php';
include 'includes/functions.php';
$conn = new Functions();

if (isset($_POST['class_id'])) {
    $class_id = $_POST['class_id'];
    $conn->query("SELECT id, name FROM sections WHERE class = :class_id");
    $conn->bind(":class_id", $class_id);
    $sections = $conn->fetchMultiple();
    echo json_encode($sections);
}
