<?php
include('includes/dbconnection.php');

$class = isset($_GET['class']) ? $_GET['class'] : '';

if ($class) {
    $stmt = $con->prepare("SELECT DISTINCT section FROM class_section WHERE class = ?");
    $stmt->bind_param("s", $class);
    $stmt->execute();
    $result = $stmt->get_result();

    $arms = [];
    while ($row = $result->fetch_assoc()) {
        $arms[] = $row['section'];
    }

    echo json_encode($arms);
}
?>
