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

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

    $sections_result = $con->query("SELECT id, term_name FROM school_terms WHERE session_id = '$class_name'");

    echo '<option value="">Select Term</option>';
    while ($row = $sections_result->fetch_assoc()) {
        echo '<option value="' . $row['id'] . '">' . $row['term_name'] . '</option>';
    }
}
