<?php
include "connect.php";
$ta =$_POST['ta'];
$semester=$_POST['semester'];
$bagian=$_POST['bagian'];
if ($bagian == "Admin" )
{
echo"<table>";
echo "<tr><td>TA</td><td>: $ta </td></tr>
	  <tr><td>Semester</td><td>: $semester </td></tr>";

//set cookie
setcookie("ta",$ta);
setcookie("semester",$semester);
$semester1=$semester-1;
?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>RESET VALIDASI</title>
</head>
<body>
<form method=post action=inputsetval.php>

<table width="617" border="1" cellpadding="1" style="border-collapse:collapse;" >
<tr align="center">
 <th width="81">Nim</th>
 <th width="443">Nama</th>
 <th width="71">Tingkat</th>
<?php
$status="AKTIF";

$sqlmhs=mysqli_query($koneksi,"select * from mhs where status='$status' AND semester='$semester1' ORDER BY mhs.kelas ASC");
while($data2=mysqli_fetch_array($sqlmhs))
{
 echo "<tr align=center><td><input type=text name=nim[] value=$data2[0]></td>";
 echo "<td align=left>$data2[1]</td>";
 echo "<td align=center>$data2[2] $data2[3]</td>
 </tr>";

}
?>
<tr><td colspan=3><input type=submit Value="Submit">
<a href="loginvalidasi.php">Back</a></td></tr>
</table>
</form>

<?
} else {
//user keuangan
if ($bagian == "Keuangan" )
{
echo"<table>";
echo "<tr><td>TA</td><td>: $ta </td></tr>
	  <tr><td>Semester</td><td>: $semester </td></tr>";

//set cookie
setcookie("ta",$ta);
setcookie("semester",$semester);

?>
<form method=post action=valkeu.php>
<table width="676" border="1" cellpadding="1" style="border-collapse:collapse;" >
<tr align="center">
 <th width="87">Nim</th>
 <th width="442">Nama</th>
 <th width="61">Tingkat</th>
 <th width="58">V Keu</th>

<?php

$sql3=mysqli_query($koneksi,"select * from validasi, mhs where validasi.nim=mhs.nim AND validasi.ta='$ta' AND validasi.semester='$semester' ORDER BY mhs.kelas ASC");
while($data3=mysqli_fetch_array($sql3))
{
 echo "<tr align=center><td><input type=text name=nim[] value=$data3[nim]></td>";
 echo "<td align=left>$data3[nm_mhs]</td>";
 echo "<td align=center>$data3[tingkat] $data3[kelas]</td>";
 echo "<td align=center>$data3[vkeu] <input type=checkbox name=v[] value=$data3[nim]>
 </tr>";

}
?>
<tr><td colspan=4><input type=submit Value="Submit">
<a href="loginvalidasi.php">Back</a></td></tr>
</table>
</form>
<?

} else {
//user lab
if ($bagian == "Lab" )
{
echo"<table>";
echo "<tr><td>TA</td><td>: $ta </td></tr>
	  <tr><td>Semester</td><td>: $semester </td></tr>";

//set cookie
setcookie("ta",$ta);
setcookie("semester",$semester);

?>
<form method=post action=vallab.php>
<table width="675" border="1" cellpadding="1" style="border-collapse:collapse;" >
<tr align="center">
 <th width="87">Nim</th>
 <th width="447">Nama</th>
 <th width="58">Tingkat</th>
 <th width="55">V Lab</th>

<?php

$sql4=mysqli_query($koneksi,"select * from validasi, mhs where validasi.nim=mhs.nim AND validasi.ta='$ta' AND validasi.semester='$semester' ORDER BY mhs.kelas ASC");
while($data4=mysqli_fetch_array($sql4))
{
 echo "<tr align=center><td><input type=text name=nim[] value=$data4[nim]></td>";
 echo "<td align=left>$data4[nm_mhs]</td>";
 echo "<td align=center>$data4[tingkat] $data4[kelas]</td>";
 echo "<td align=center>$data4[vlab] <input type=checkbox name=v[] value=$data4[nim]>
 </tr>";

}
?>
<tr><td colspan=4><input type=submit Value="Submit">
<a href="loginvalidasi.php">Back</a></td></tr>
</table>
</form>
<?

} else {
//user Kemahasiswaan
if ($bagian == "Kemahasiswaan" )
{
echo"<table>";
echo "<tr><td>TA</td><td>: $ta </td></tr>
	  <tr><td>Semester</td><td>: $semester </td></tr>";

//set cookie
setcookie("ta",$ta);
setcookie("semester",$semester);

?>
<form method=post action=valkmh.php>
<table width="675" border="1" cellpadding="1" style="border-collapse:collapse;" >
<tr align="center">
 <th width="87">Nim</th>
 <th width="447">Nama</th>
 <th width="58">Tingkat</th>
 <th width="55">V Kmhs</th>

<?php

$sql5=mysqli_query($koneksi,"select * from validasi, mhs where validasi.nim=mhs.nim AND validasi.ta='$ta' AND validasi.semester='$semester' ORDER BY mhs.kelas ASC");
while($data5=mysqli_fetch_array($sql5))
{
 echo "<tr align=center><td><input type=text name=nim[] value=$data5[nim]></td>";
 echo "<td align=left>$data5[nm_mhs]</td>";
 echo "<td align=center>$data5[tingkat] $data5[kelas]</td>";
 echo "<td align=center>$data5[vkmh] <input type=checkbox name=v[] value=$data5[nim]>
 </tr>";

}
?>
<tr><td colspan=4><input type=submit Value="Submit">
<a href="loginvalidasi.php">Back</a></td></tr>
</table>
</form>
<?

} else {
//user Perpustakaan
if ($bagian == "Perpustakaan" )
{
echo"<table>";
echo "<tr><td>TA</td><td>: $ta </td></tr>
	  <tr><td>Semester</td><td>: $semester </td></tr>";

//set cookie
setcookie("ta",$ta);
setcookie("semester",$semester);

?>
<form method=post action=vallib.php>
<table width="675" border="1" cellpadding="1" style="border-collapse:collapse;" >
<tr align="center">
 <th width="87">Nim</th>
 <th width="447">Nama</th>
 <th width="58">Tingkat</th>
 <th width="55">V Lib</th>

<?php

$sql6=mysqli_query($koneksi,"select * from validasi, mhs where validasi.nim=mhs.nim AND validasi.ta='$ta' AND validasi.semester='$semester' ORDER BY mhs.kelas ASC");
while($data6=mysqli_fetch_array($sql6))
{
 echo "<tr align=center><td><input type=text name=nim[] value=$data6[nim]></td>";
 echo "<td align=left>$data6[nm_mhs]</td>";
 echo "<td align=center>$data6[tingkat] $data6[kelas]</td>";
 echo "<td align=center>$data6[vlib] <input type=checkbox name=v[] value=$data6[nim]>
 </tr>";

}
?>
<tr><td colspan=4><input type=submit Value="Submit">
<a href="loginvalidasi.php">Back</a></td></tr>
</table>
</form>
<?

} else {
//user Kemahasiswaan
if ($bagian == "Kemahasiswaan" )
{
echo"<table>";
echo "<tr><td>TA</td><td>: $ta </td></tr>
	  <tr><td>Semester</td><td>: $semester </td></tr>";

//set cookie
setcookie("ta",$ta);
setcookie("semester",$semester);

?>
<form method=post action=valkmh.php>
<table width="675" border="1" cellpadding="1" style="border-collapse:collapse;" >
<tr align="center">
 <th width="87">Nim</th>
 <th width="447">Nama</th>
 <th width="58">Tingkat</th>
 <th width="55">V Kmhs</th>

<?php

$sql5=mysqli_query($koneksi,"select * from validasi, mhs where validasi.nim=mhs.nim AND validasi.ta='$ta' AND validasi.semester='$semester' ORDER BY mhs.kelas ASC");
while($data5=mysqli_fetch_array($sql5))
{
 echo "<tr align=center><td><input type=text name=nim[] value=$data5[nim]></td>";
 echo "<td align=left>$data5[nm_mhs]</td>";
 echo "<td align=center>$data5[tingkat] $data5[kelas]</td>";
 echo "<td align=center>$data5[vkmh] <input type=checkbox name=v[] value=$data5[nim]>
 </tr>";

}
?>
<tr><td colspan=4><input type=submit Value="Submit">
<a href="loginvalidasi.php">Back</a></td></tr>
</table>
</form>
<?

} else {
//user Akademik
if ($bagian == "Akademik" )
{
echo"<table>";
echo "<tr><td>TA</td><td>: $ta </td></tr>
	  <tr><td>Semester</td><td>: $semester </td></tr>";

//set cookie
setcookie("ta",$ta);
setcookie("semester",$semester);

?>
<form method=post action=valakd.php>
<table width="675" border="1" cellpadding="1" style="border-collapse:collapse;" >
<tr align="center">
 <th width="87">Nim</th>
 <th width="447">Nama</th>
 <th width="58">Tingkat</th>
 <th width="55">V Akd</th>

<?php

$sql7=mysqli_query($koneksi,"select * from validasi, mhs where validasi.nim=mhs.nim AND validasi.ta='$ta' AND validasi.semester='$semester' ORDER BY mhs.kelas ASC");
while($data7=mysqli_fetch_array($sql7))
{
 echo "<tr align=center><td><input type=text name=nim[] value=$data7[nim]></td>";
 echo "<td align=left>$data7[nm_mhs]</td>";
 echo "<td align=center>$data7[tingkat] $data7[kelas]</td>";
 echo "<td align=center>$data7[vakd] <input type=checkbox name=v[] value=$data7[nim]>
 </tr>";

}
?>
<tr><td colspan=4><input type=submit Value="Submit">
<a href="loginvalidasi.php">Back</a></td></tr>
</table>
</form>
<?
}
}
}
}
}
}
}
?>
</body>
</html>