<?php

if(isset($_GET['no']))
{
$a="delete from tbl_kom_input where no='".$_GET['no']."'";
$b=mysql_query($a);
header('location:komite_menu.php?id=2');
}

?>
<html>
	<head>

	</head>
	<body>
		<table height="100%" width="100%" border="0">
			<tr height="50%">
				
				<td bgcolor="c19cf4">
					<table width="100%" border="0">
						<p> INPUT IURAN KOMITE </p>
						<form action="" method="post"> 	
							<tr>
								<td width="150px" align="left" bgcolor="grey"> NIS </td>
								<td > : </td>
								<td><input type="text" name="nis"> </td>
							</tr>
		
							<tr>
								<td bgcolor="grey"> KODE BAYAR </td>
								<td> : </td>
								<td> <input type="text" name="kode_bayar"> </td>
								
							</tr>

							<tr>
								<td bgcolor="grey"> BANYAK </td>
								<td> : </td>
								<td> <input type="text" name="banyak" > </td>
							</tr>

														
							
							<tr>
								<td><input type="submit" name="simpan" value="Simpan"><input type="submit" name="edit" value="Edit"></td>
								<td></td>
								<td> <input type="date" name="tanggal_bayar" value="<?php echo date('Y-m-d'); ?>" readonly> </td>
							</tr>
						
						<?php
							include ('library/inc.connection.php');
							if(isset($_POST['simpan']))
							{
							$a="insert into tbl_bayar values('','".$_POST['nis']."','".$_POST['kode_bayar']."','".$_POST['tanggal_bayar']."','".$_POST['banyak']."')";
							mysql_query($a);
							}
						?> 
						</form>
					</table>

				</td>
				
			</tr>
			<tr>
				<td>
					<table border="1" width="100%">
						<thead>
							<tr>
								<th>NIS</th>
								<th>NAMA</th>
								<th>KODE BAYAR</th>
								<th>TANGGAL</th>
								<th>BANYAK</th>
								
							</tr>
						</thead>
						<tbody>
							<?php
							include ('library/inc.connection.php');
							$b="SELECT tbl_bayar.nis, tbl_biodata.nama_siswa, tbl_bayar.kode_bayar, tbl_bayar.tanggal_bayar, tbl_bayar.banyak
								FROM tbl_biodata, tbl_bayar
								WHERE tbl_bayar.nis = tbl_biodata.nis 
								ORDER BY tbl_bayar.id desc limit 5";
							$c=mysql_query($b);
							while ($isi=mysql_fetch_object($c))
							{
								
							?>
						<tr>
							<td><?php echo $isi->nis ; ?> </td>
							<td><?php echo $isi->nama_siswa;?> </td>
							<td><?php echo $isi->kode_bayar; ?> </td>
							<td><?php echo $isi->tanggal_bayar; ?> </td>
							<td><?php echo $isi->banyak; ?> </td>
							
						</tr>
						
							<?php
							}
							?>
						</tbody>
					</table>

				
				</td>
			</tr>	
				
		</table>
	</body>

</html>