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

$cek = mysqli_query($koneksi,"select * from validasi where nim='$nim' AND semester='$semester'AND ta='$ta'");
$hasil=mysqli_fetch_row($cek);
if($hasil>0)
{
if($hasil[3]=="N" || $hasil[4]=="N" || $hasil[5]=="N" || $hasil[5]=="N" || $hasil[6]=="N" || $hasil[7]=="N")
{
echo "Anda belum menyelesaiakan administrasi :<br>";
	if($hasil[3]=="N"){
	echo "- Keuangan <br>";
	}
	if($hasil[4]=="N"){
	echo "- Kemahasiswaan <br>";
	}
	if($hasil[5]=="N"){
	echo "- Laboratorium <br>";
	}
	if($hasil[6]=="N"){
	echo "- Perpustakaan <br>";
	}
	if($hasil[7]=="N"){
	echo "- Akademik <br>";
	}
die("Silahkan Hubungi bagian terkait <a href=fkrsmhs.php>close</a>");
}

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>';
?>

<html>
<body>
<form method=post action=inputkrsmhs.php>
<table width="773" border="1">
<tr align="center">
 <th width="131">kode</th>
 <th width="494">Matakuliah </th>
 <th width="61">SKS</th>
 <th width="59">Ambil </th></tr>
<?php

$sqlmtk=mysqli_query($koneksi,"select * from mtk where semester='$semester' and kur='$kur'");
while($data2=mysqli_fetch_array($sqlmtk))
{
 echo "<tr align=center><td>$data2[0]</td>";
 echo "<td align=left>$data2[1]</td>";
 echo "<td align=center><input type=text name=jsks[] value=$data2[2]></td>";
 echo "<td><input type=checkbox name=kd_mtk[] value=$data2[0] checked></td></tr>";

}
?>
<tr><td colspan=4><input type=submit Value="Submit">
<input type=reset Value="Cancel"></td></tr>
</table>
</form>
<?
} else {
echo "Silahkan pilih semester yang akan ditempuh <a href=fkrsmhs.php>close</a>";
}
?>
</body>
</html>

