<?php include("config.php"); ?>
<!DOCTYPE html>
<html>
<head>
<title>Pendaftaran Siswa Baru | SMK Coding</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.10.2/dist/umd/popper.min.js" integrity="sha384-7+zCNj/IqJ95wo16oMtfsKbZ9ccEh31eOz1HGyDuCQ6wgnyJNSYdrPa03rtR1zdB" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.min.js" integrity="sha384-QJHtvGhmr9XOIpI6YVutG+2QOK9T+ZnN4kzFN1RtK3zEFEIsxhlmWl5/YESvpZ13" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<div class="container">
<header>
<center>
<h3>Siswa yang sudah mendaftar</h3>
</center>
</header>
<nav>
<a href="form-daftar.php" class="btn btn-secondary"><i class="fa fa-plus"></i> Tambah Data Baru</a>
</nav>
<br>
<table class="table">
<thead class="thead-dark">
<tr>
<th scope="col">No</th>
<th scope="col">Nama</th>
<th scope="col">Alamat</th>
<th scope="col">Jenis Kelamin</th>
<th scope="col">Agama</th>
<th scope="col">Sekolah Asal</th>
<th scope="col">Tindakan</th>
</tr>
</thead>
<tbody>
<?php
$sql = "SELECT * FROM calon_siswa";
$query = mysqli_query($db, $sql);
while($siswa = mysqli_fetch_array($query)){
echo "<tr>";
echo "<td>".$siswa[\'id\']."</td>";
echo "<td>".$siswa[\'nama\']."</td>";
echo "<td>".$siswa[\'alamat\']."</td>";
echo "<td>".$siswa[\'jenis_kelamin\']."</td>";
echo "<td>".$siswa[\'agama\']."</td>";
echo "<td>".$siswa[\'sekolah_asal\']."</td>";
echo "<td>";
echo "<a href=\'form-edit.php?id=".$siswa[\'id\']."\'>Edit</a> | ";
echo "<a href=\'hapus.php?id=".$siswa[\'id\']."\'>Hapus</a>";
echo "</td>";
echo "</tr>";
}
?>
</tbody>
</table>
<center><a href="index.php" class="btn btn-primary">Kembali</a></center>
<!-- <p>Total: <?php echo mysqli_num_rows($query) ?></p> -->
</div>
</body>
</html>
<?php if(isset($_GET[\'status\'])): ?>
<p>
<?php
if($_GET[\'status\'] == \'sukses\'){
echo "Pendaftaran siswa baru berhasil!";
} else {
echo "Pendaftaran gagal!";
}
?>
</p>
<?php endif; ?>