<META NAME="robots" CONTENT="noindex,nofollow">


<?php 
    include '../helpers/helpers.php'; checkLogin('student'); 
    include '../config/config.php';
    $user_id = $_SESSION['user']['id'];
    $result = $conn->query("SELECT * FROM leave_requests WHERE student_id IN (SELECT student_id FROM students WHERE user_id=$user_id) ORDER BY id DESC");
?>
<html>
    <head><link rel="stylesheet" href="../assets/css/style.css"></head>
    <body>
        <div class="card">
            <h2>Student Dashboard</h2>
            <a href="leave_form.php">Apply Leave</a>   <a href="../logout.php">Logout</a><br><br>
        <table border=1><tr><th>ID</th><th>Subject</th><th>Status</th></tr>
            <?php while($r = $result->fetch_assoc()): ?>
                <tr><td><?= $r['id'] ?></td><td><?= $r['subject'] ?></td><td><?= $r['status'] ?></td></tr>
            <?php endwhile; ?>
        </table