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

setcookie("kd_mtk",$kd_mtk);
setcookie("semester",$semester);
setcookie("ta",$ta);
setcookie("kelas",$kelas);

echo"<table border=1>";

$sqlmtk=mysqli_query($koneksi,"select * from mtk where kd_mtk= '$kd_mtk'");
$datamtk=mysqli_fetch_row($sqlmtk);
if ($datamtk){
echo"
<tbody>
<tr bgcolor=#FFCC00>
<td colspan=4>Nama MK = <strong>$datamtk[1]</strong>
";
echo"Semester = $semester
";
echo"Kelas = $kelas
";
echo"ta = $ta</td>
</tr>
";
}
setcookie("kd_mtk",$kd_mtk);
setcookie("semester",$semester);
setcookie("ta",$ta);
setcookie("kelas",$kelas);
?>
<form method=post action=simpannilai.php>
<tr bgcolor="#FFCC00">
<th> No</th>
<th> Nim</th>
<th> Nama</th>
<th> Nilai</th>
</tr>
<?php
$sqlkrs= mysqli_query($koneksi,"select * from krs,mtk,mhs where krs.nim=mhs.nim and
 krs.kd_mtk='$kd_mtk'
 AND krs.kd_mtk = mtk.kd_mtk
 AND krs.semester = '$semester' AND krs.ta='$ta' AND mhs.kelas='$kelas'  ORDER BY mhs.nim ASC");
 $no=1;
while($datakrs=mysqli_fetch_array($sqlkrs)){
echo"
<tr>
<td><input name=id[$no] type=text value=$no /></td>";
echo "
<td><input name=nim[$no] type=text value=$datakrs[nim] /></td>
";
echo "
<td bgcolor=#FFFFCC>$datakrs[nm_mhs]</td>
";
echo "
<td><input name=nilai[$no] type=text value=$datakrs[nilai] ></td>
</tr>
";
$no++;
}
?>
<tr>
<td colspan="4">
<input type="submit" value="Submit" />
<input type="reset" value="Cancel" /></td>
</tr>
</tbody>
</table>
</form>
</pre>

