
        <?php include 'include/navbar.php';?>
        <?php include 'include/sidebar.php';?>
     
            <div id="layoutSidenav_content">
                <main>
                    <div class="container-fluid px-4">
                        <h1 class="mt-4">Dashboard</h1>
                        <ol class="breadcrumb mb-4">
                            <li class="breadcrumb-item active">Country List</li>
                        </ol>

                        <div class=" mt-4">

<table class="table table-bordered mt-4 example">
  <thead class="">
    <tr>
      <th>#</th>
      <th>Country Name</th>
      <th>Actions</th>
    </tr>
  </thead>
  <tbody>
    <?php
    $countries = mysqli_query($conn, "SELECT * FROM countries ORDER BY country_name ASC");
    $i = 1;
    while ($row = mysqli_fetch_assoc($countries)):
    ?>
      <tr>
        <td><?= $i++; ?></td>
        <td><?= $row['country_name']; ?></td>
        <td>
          <a href="?id=<?= $row['id']; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Delete country?')">Delete</a>
        </td>
      </tr>
    <?php endwhile; ?>
    <?php
if (isset($_GET['id'])) {
    $id = intval($_GET['id']);
    $delete = "DELETE FROM countries WHERE id = $id";
    if (mysqli_query($conn, $delete)) {
        header("Location: country-list.php");
        exit;
    } else {
        echo "Failed to delete job.";
    }
}

?>
  </tbody>
</table>

                    </div>
                </main>
                <?php include "include/footer.php";?>
            </div>
        </div>
<!-- JS TextEditor -->
<script src="//cdn.ckeditor.com/4.13.1/standard/ckeditor.js"></script>
         <script>
        CKEDITOR.replace('arContent');
    </script>
        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
        <script src="js/scripts.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.js" crossorigin="anonymous"></script>
        <script src="assets/demo/chart-area-demo.js"></script>
        <script src="assets/demo/chart-bar-demo.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/simple-datatables@latest" crossorigin="anonymous"></script>
        <script src="js/datatables-simple-demo.js"></script>
    </body>
</html>
