<section> 
    <?php 
    if (isset($_GET['template'])) { 
        header('Content-Type: text/xls');
        header('Content-Disposition: attachment; filename="'.$_GET['kode_tapel'].'-template_peserta_didik.xls"');
        echo '<table border="1" cellspacing="0" cellpadding="0"> 
        <tr style="background-color:yellow;">
        <td>kode_tapel</td>
        <td>kelas</td>
        <td>nisn</td>
        <td>nis</td>
        <td>nama</td>
        <td>jk</td>
        <td>tmp_lahir</td>
        <td>tgl_lahir</td>
        <td>agama</td>
        <td>status</td>
        <td>anak_ke</td>
        <td>alamat_siswa</td>
        <td>no_hp</td>
        <td>sekolah_asal</td>
        <td>diterima_di_kls</td>
        <td>tanggal</td>
        <td>nama_ayah</td>
        <td>nama_ibu</td>
        <td>alamat</td>
        <td>telepon</td>
        <td>kerja_ayah</td>
        <td>kerja_ibu</td>
        <td>nama_wali</td>
        <td>no_telepon</td>
        <td>alamat_wali</td>
        <td>kerja_wali</td>
        </tr>'
        ?>

        <?php 
        $jumlah_siswa=$_GET['jumlah_siswa'];
        for ($i=1; $i <= $jumlah_siswa; $i++) {  
           echo  '<tr>
           <td>'.$_GET['kode_tapel'].'</td>
           <td>&nbsp;</td>
           <td>&nbsp;</td>
           <td>&nbsp;</td>
           <td>&nbsp;</td>
           <td>&nbsp;</td>
           <td>&nbsp;</td>
           <td>&nbsp;</td>
           <td>&nbsp;</td>
           <td>&nbsp;</td>
           <td>&nbsp;</td>
           <td>&nbsp;</td>
           <td>&nbsp;</td>
           <td>&nbsp;</td>
           <td>&nbsp;</td>
           <td>&nbsp;</td>
           <td>&nbsp;</td>
           <td>&nbsp;</td>
           <td>&nbsp;</td>
           <td>&nbsp;</td>
           <td>&nbsp;</td>
           <td>&nbsp;</td>
           <td>&nbsp;</td>
           <td>&nbsp;</td>
           <td>&nbsp;</td>
           <td>&nbsp;</td>
           </tr>';
           ?>

       <?php } ?>
   </table>
   <meta http-equiv="refresh" content="0;url=../PesertaDidikList" />
<?php } ?> 
</section> 