<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

include '../config/koneksi.php';
if (!isset($_GET['id'])) {
  echo "ID tidak ditemukan.";
  exit;
}
$id = intval($_GET['id']);
$data = mysqli_fetch_assoc(mysqli_query($conn, "SELECT * FROM pendaftar WHERE id = $id"));
?>

<!DOCTYPE html>
<html lang="id">
<head>
  <meta charset="UTF-8">
  <title>Bukti Pendaftaran</title>
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="container py-5">
  <h2 class="text-center mb-4">Bukti Pendaftaran</h2>
  <table class="table table-bordered">
    <tr><th>Nomor Pendaftaran</th><td><?= $data['nomor_pendaftaran'] ?></td></tr>
    <tr><th>Nama Lengkap</th><td><?= $data['nama_lengkap'] ?></td></tr>
    <tr><th>NISN</th><td><?= $data['nisn'] ?></td></tr>
    <tr><th>Tempat, Tanggal Lahir</th><td><?= $data['tempat_lahir'] ?>, <?= $data['tanggal_lahir'] ?></td></tr>
    <tr><th>Jenis Kelamin</th><td><?= $data['jenis_kelamin'] ?></td></tr>
    <tr><th>Alamat</th><td><?= $data['alamat'] ?></td></tr>
  </table>

  <div class="text-center mt-4">
    <button onclick="window.print()" class="btn btn-primary">Cetak Bukti</button>
    <a href="index.php" class="btn btn-secondary">Kembali ke Beranda</a>
  </div>
</body>
</html>