<?php
include('session_validator.php');
?>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="css/bootstrap.min.css" media="screen">
     <link rel="stylesheet" href="css/main.css" media="screen">
    <link rel="stylesheet" href="css/font-awesome.min.css" media="screen">
    <link rel="stylesheet" href="css/animate-css/animate.min.css" media="screen">
    <link rel="stylesheet" href="css/lobipanel/lobipanel.min.css" media="screen">
    <link rel="stylesheet" href="css/prism/prism.css" media="screen">
    <link rel="stylesheet" href="css/tablestyle.css" type="text/css">
    <link rel="stylesheet" href="css/select2/select2.min.css">
   


    <script src="js/multiselect-dropdown.js"></script>
    <script src="js/modernizr/modernizr.min.js"></script>
    <!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css"> -->

    <title>Ledger</title>
</head>

<body class="top-navbar-fixed">

    <div class="main-wrapper">
        <!-- ========== TOP NAVBAR ========== -->
        <?php include('includes/topbar.php'); ?>
        <!-- ========== WRAPPER FOR BOTH SIDEBARS & MAIN CONTENT ========== -->
        <div class="content-wrapper">
            <div class="content-container">
                <!-- ========== LEFT SIDEBAR ========== -->
                <?php include('includes/leftbar.php'); ?>
                <!-- /.left-sidebar -->
                <div class="main-page">
                    <div class="container-fluid">
                        <div class="row page-title-div">
                            <div class="col-md-6">
                                <h2 class="title">Select Class to Generate Blank Mark Slip</h2>
                            </div>
                        </div>
                        <div class="row breadcrumb-div">
                            <div class="col-md-6">
                                <ul class="breadcrumb">
                                    <li><a href="dashboard.php"><i class="fa fa-home"></i> Home</a></li>
                                    <li> Marks </li>
                                    <li class="">Blank Mark Slip</li>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="panel">
                                    <div class="panel-heading">
                                        <div class="panel-title">
                                            <h5>Select Class</h5>
                                        </div>
                                    </div>
                                    <div class="panel-body">
                                        <!-- Update the form in marks_ledger.php -->
                                        <form action="ledgerthpr.php" method="get">
                                            <div class="form-row">
                                                <div class="form-group col-md-3">
                                                    <label for="exam_id">Select Exam:</label>
                                                    <select id="exam_id" name="exam_id" class="form-control" required>
                                                        <option value="">Select Exam</option>
                                                        <?php
                                                        // Include the database configuration file
                                                        include("includes/db.php");

                                                        // Fetch class names from the 'classes' table
                                                        $queryexam = "SELECT id, exm_year , exam_type FROM examination_type";
                                                        $resultexam = $conn->query($queryexam);

                                                        // Populate the dropdown with class names and sections
                                                        while ($row = $resultexam->fetch_assoc()) {
                                                            echo "<option value='" . $row['id'] . "'>" . $row['exam_type'] . " - " . $row['exm_year'] . "</option>";
                                                        }

                                                        ?>
                                                    </select>
                                                </div>

                                                <div class="form-group col-md-6">
                                                    <label for="class_id">Select Class:</label>
                                                    <select name="class_id[]" id="class_id" class="form-control" multiple required>
                                                        <option value="">Select Class</option>
                                                        <!-- Populate dropdown options dynamically from your database -->
                                                        <?php
                                                        // Include database connection code
                                                        include("includes/db.php");

                                                        // Query classes from the database
                                                        $classQuery = "SELECT class_id, class_name, section FROM classes";
                                                        $classResult = $conn->query($classQuery);

                                                        while ($row = $classResult->fetch_assoc()) {
                                                            echo "<option value='" . $row['class_id'] . "'>" . $row['class_name'] . " - " . $row['section'] . "</option>";
                                                        }

                                                        // Close the database connection
                                                        $conn->close();
                                                        ?>
                                                    </select>
                                                </div>
                                                <div class="form-group">
                                                    <button type="submit" class="btn btn-primary">Show Ledger</button>
                                                </div>
                                            </div>
                                        </form>
                                    </div>
                                </div>
                            </div>
                            <!-- /.col-md-12 -->
                        </div>
                    </div>
                </div>
            </div>
            <!-- /.content-container -->
        </div>
        <!-- /.content-wrapper -->
    </div>
    <!-- /.main-wrapper -->
    <script src="js/jquery/jquery-2.2.4.min.js"></script>
    <script src="js/bootstrap/bootstrap.min.js"></script>
    <script src="js/pace/pace.min.js"></script>
    <script src="js/lobipanel/lobipanel.min.js"></script>
    <script src="js/iscroll/iscroll.js"></script>
    <script src="js/prism/prism.js"></script>
    <script src="js/main.js"></script>
    <script src="js/modernizr/modernizr.min.js"></script>

    
</body>

</html>
