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


if (isset($_POST['class'])) {
    $class = trim($_POST['class']);

    // Fetch arms based on the inputted class
    $query = "SELECT DISTINCT section FROM class_section  WHERE class = ?";
    $stmt = $con->prepare($query);
    $stmt->bind_param("s", $class);
    $stmt->execute();
    $result = $stmt->get_result();

    echo '<option value="">Select Arm/Section</option>'; // Default option
    while ($row = $result->fetch_assoc()) {
        echo '<option value="' . htmlspecialchars($row['section']) . '">' . htmlspecialchars($row['section']) . '</option>';
    }

    $stmt->close();
    $con->close();
}
?>
