<html>
<head>
<title> Form Input Nilai </title>
<style type="text/css">
<!--
.style1 {
	font-size: medium;
	font-weight: bold;
}
.style2 {font-size: medium}
-->
</style>
</head>
<body>
<h3 align="center">--- Input Nilai ---</h3>
<?php
include "connect.php";
session_start();

//cek apakah user sudah login


//cek level user
if($_SESSION['Level']=="baak" || $_SESSION['Level']=="admin" || $_SESSION['Level']=="dosen"){

?>
<table frame="border" width="725">
<form method=post action="inputnilai.php">
<tr>
  <td width="155" rowspan="5"><a href="fkrs.php"><img src="picture/icon-krs.gif" width="155" height="136" border="0"></a></td>
  <td width="117">&nbsp;</td>
  <td width="136"><strong>Mata Kuliah </strong></td>
  <td width="297"><strong>
    <select name="kd_mtk">
          <option>--- Pilih Mata Kuliah ---</option>
<?php
	include "connect.php";
	$id=1;
	$hasil = mysqli_query($koneksi,"select * from tset where idset ='$id'");
	$row=mysqli_fetch_array($hasil);
    $sql = mysqli_query($koneksi,"SELECT * FROM mtk where kur= $row[10] ORDER BY nm_mtk ASC");
    if(mysqli_num_rows($sql) != 0){
        while($row1 = mysqli_fetch_assoc($sql)){
           // echo '<option>'.$row1['kd_mtk'].'</option>';
			echo"<option value='$row1[kd_mtk]'>$row1[nm_mtk]</option>";
        }
    }
  ?>
        </select>
  </strong></td>
</tr>
<tr>
  <td>&nbsp;</td>
  <td><strong>Semester</strong></td>
  <td><strong>
    <select size="1" name ="semester">
      <option selected></option>
      <option>1</option>
      <option>2</option>
      <option>3</option>
      <option>4</option>
      <option>5</option>
      <option>6</option>
    </select>
  </strong></td>
</tr>
<tr>
  <td>&nbsp;</td>
  <td><strong>Kelas</strong></td>
  <td><strong>
    <select size="1" name ="kelas">
      <option selected></option>
      <option>A</option>
      <option>B</option>
      <option>C</option>
    </select>
  </strong></td>
</tr>
<tr>
  <td>&nbsp;</td>
  <td><strong>TA</strong></td>
  <td><input name ="ta" type = text style="background-color:#CCFFFF " value="<? echo $row[2]; ?>">  </td>
</tr>
<tr>
  <td colspan="3">
    <strong>
<input type =submit value="Submit">
<input type=reset value ="Cancel"> 
    </strong><strong>| <a href=logout.php>Log Out</a></strong></td>
  </tr>
</form>
</table>
<?
$kur= $row[10];
	$hasil=mysqli_query($koneksi,"select * from mtk where kur='$kur' order by semester asc");
	$total = mysqli_num_rows($hasil);
?>
<table width="724" border="1">
  <tr bgcolor="#FF9900">
    <td width="73"><span class="style1">Kode</span></td>
    <td width="502"><span class="style1">Mata Kuliah </span></td>
    <td width="52"><div align="center" class="style1">SKS</div></td>
    <td width="69"><span class="style1">Semester</span></td>
  </tr>
  	<?
	if ($total){
		while ($row=mysqli_fetch_array($hasil))
		{
		?>
  <tr bgcolor="#FFFFCC">
    <td><span class="style2"><font face="verdana"><? echo $row[0]; ?></font></span></td>
    <td><span class="style2"><font face="verdana"><? echo $row[1]; ?></font></span></td>
    <td><div align="center" class="style2"></div>
    <div align="center" class="style2"><font face="verdana"><? echo $row[2]; ?></font></div></td>
    <td><div align="center" class="style2"><font face="verdana"><? echo $row[3]; ?></font></div></td>
  </tr>
  <?
 		 }
  			}
  ?>
</table>

<?php
} else {
    die("Anda bukan admin");
}
?>
</body>
</html>




