<!DOCTYPE html>
<html>
<head>
	<title>Export Data PESERTA TO CPNS E2C</title>
</head>
<body>
	<style type="text/css">
	body{
		font-family: sans-serif;
	}
	table{
		margin: 20px auto;
		border-collapse: collapse;
	}
	table th,
	table td{
		border: 1px solid #3c3c3c;
		padding: 3px 8px;
 
	}
	a{
		background: blue;
		color: #fff;
		padding: 8px 10px;
		text-decoration: none;
		border-radius: 2px;
	}
	</style>
 
	<?php
	header("Content-type: application/vnd-ms-excel");
	header("Content-Disposition: attachment; filename=Data Peserta Try Out.xls");
	?>
 

	<table border="1">
		<tr>
			<th>No.</th>
			<th>NO UJIAN</th>
			<th>NAMA</th>
			<th>TEMPAT LAHIR</th>
			<th>TGL LAHIR</th>
			<th>ASAL UJIAN</th>
			<th>KATEGORI</th>
			<th>PENDIDIKAN</th>
		</tr>
		<?php 
		// koneksi database
		$koneksi = mysqli_connect("localhost", "u9616605_pendaftarancpns", "DanangE2c2020", "u9616605_pendaftarancpns");
 
		// menampilkan data pegawai
		$data = mysqli_query($koneksi,"select * from tb_siswa");
		$no = 1;
		while($d = mysqli_fetch_array($data)){
		?>
		<tr>
			<td><?php echo $no++; ?></td>
			<td style=mso-number-format:\@; ><?php echo $d['no_hp']; ?></td>
			<td><?php echo $d['nama_lengkap']; ?></td>
			<td><?php echo $d['tempat_lahir']; ?></td>
			<td><?php echo $d['tgl_lahir']; ?></td>
			<td><?php echo $d['alumni']; ?></td>
			<td>KEDINASAN</td>
			<td>SLTA</td>
		</tr>
		<?php 
		}
		?>
	</table>
</body>
</html>