<?php include "config/koneksi.php"; ?>
<!DOCTYPE html>
<html>
<head>
    <title>Modul MTCNA</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>

<div class="container mt-5">
    <h2 class="text-center fw-bold">Download Modul</h2>

    <table class="table table-striped table-bordered mt-4">
        <tr>
            <th>No</th>
            <th>Nama Modul</th>
            <th>Aksi</th>
        </tr>

        <?php
        $no = 1;
        $data = mysqli_query($conn, "SELECT * FROM modul ORDER BY id DESC");
        while($d = mysqli_fetch_array($data)){
        ?>

        <tr>
            <td><?= $no++ ?></td>
            <td><?= $d['nama_modul'] ?></td>
            <td>
                <a href="modul/<?= $d['nama_file'] ?>" class="btn btn-success btn-sm" download>
                    📄 Download
                </a>
            </td>
        </tr>

        <?php } ?>

    </table>
</div>

</body>
</html>