<?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, subject_name FROM subjects WHERE class_id = :class_id");
    $conn->bind(":class_id", $class_id);
    $subjects = $conn->fetchMultiple();
    echo json_encode($subjects);
}
