<?php
defined('APK') or exit('Anda tidak dizinkan mengakses langsung script ini!');
$mapel = $_POST['mapel'];
$kelas = $_POST['kelas'];
$smt = $_POST['semester'];
?>
<div class='row'>
        <div class='col-md-12'>
              <div class="card">
             <div class="card-header">	
                    <h5 class='card-title'><i class="fas fa-upload fa-fw"></i> <?= $mapel ?> - <?= $kelas ?> - SEMESTER <?= $smt ?></h4>
                </div>
				
			 
                <div class='card-body'>
                <div class="table-responsive">
                    <table style="font-size: 12px" class="table table-bordered table-hover" id="datatable1">
                        <thead>
                            <tr>
                                <th class="text-center" width="3%" rowspan="2">
                                    #
                                </th>
                              <th width="10%" rowspan="2">ROMBEL</th>
                                <th rowspan="2">N I S</th>
								 <th rowspan="2">N I S N</th>
                                 <th rowspan="2">NAMA SISWA</th>
                              <th style="text-align:center" colspan="2"><?= $mapel ?></th>
                             </tr>
							 <tr>
							 <th width="10%"> KI-3</th>
							 <th width="10%">KI-4</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            $query = mysqli_query($koneksi, "select * from nilai_skl WHERE kelas='$kelas' AND mapel='$mapel' AND semester='$smt' GROUP BY nis");
                            $no = 0;
                            while ($s = mysqli_fetch_array($query)) {
								$siswa = fetch($koneksi,'siswa',['nis'=>$s['nis']]);
								
								$no++;
                            ?>
                                <tr>
                                    <td><?= $no; ?></td>
                                   <td><?= $siswa['kelas'] ?></td>
								   <td><?= $siswa['nis'] ?></td>
								   <td><?= $siswa['nisn'] ?></td>
                                    <td><?= $siswa['nama'] ?></td>             
                                     <td><?= $s['nilai_p'] ?></td>
                                   <td><?= $s['nilai_k'] ?></td>
                                </tr>

                            <?php }
                            ?>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
