<?php
include "connect.php";
$nim=$_POST['nim'];
$semester =$_POST['semester'];
$ta =$_POST['ta'];
$kur =$_POST['kur'];
echo"<table>";

$sqlmhs=mysqli_query($koneksi,"select * from mhs where nim='$nim'");
$datamhs=mysqli_fetch_row($sqlmhs);

echo "<tr><td>NIM</td><td>: $datamhs[0]</td></tr>
      <tr><td>Nama</td><td>: $datamhs[1]</td></tr>
	  <tr><td>Tingkat</td><td>: $datamhs[2] $datamhs[3]</td></tr>
	  <tr><td>Semester</td><td>: $semester</td></tr>
	  <tr><td>TA</td><td>: $ta </td></tr>
	  <tr><td>Kurikulum</td><td>: $kur </td></tr>";

//set cookie
setcookie("nim",$nim);
setcookie("namamhs",$datamhs[1]);
setcookie("tingkat",$datamhs[2]);
setcookie("kelas",$datamhs[3]);
setcookie("semester",$semester);
setcookie("ta",$ta);
setcookie("kur",$kur);
//'</table>';
?>
<table width="753" height="29" border="1">
<tr><th width="39" height="23">No.</th>
 <th width="122">Kode</th>
 <th width="480">Matakuliah</th>
 <th width="84">SKS</th>
</tr>
<?php
include "connect.php";
$sqlkrs = mysqli_query($koneksi,"SELECT * FROM krs, mtk WHERE nim='$nim'
 AND krs.kd_mtk = mtk.kd_mtk
 AND krs.semester='$semester' AND krs.ta='$ta'");
$jumsks = 0;
$i = 1;
while($datakrs = mysqli_fetch_array($sqlkrs)){
 echo "<tr align=center><td>$i</td>";
 echo "<td>$datakrs[kd_mtk]</td>";
 echo "<td align=left>$datakrs[nm_mtk]</td>";
 echo "<td>$datakrs[sks]</td></tr>";
 $jumsks = $jumsks + $datakrs['sks'];
 $i++;
}
echo "<tr align=center><td colspan=3>JUMLAH</td><td>$jumsks</td></tr>";
?>
</table>
