<?php
include("sess_check.php");

if (isset($_GET['siswa'])) {
	$sql = "SELECT * FROM siswa WHERE nis='" . $_GET['siswa'] . "'";
	$ress = mysqli_query($conn, $sql);
	$data = mysqli_fetch_array($ress);
}
// deskripsi halaman
$pagedesc = "Data Siswa";
$menuparent = "siswa";
include("layout_top.php");
?>
<!-- top of file -->
<!-- Page Content -->
<div id="page-wrapper">
	<div class="container-fluid">
		<div class="row">
			<div class="col-lg-12">
				<h1 class="page-header">Data Siswa</h1>
			</div><!-- /.col-lg-12 -->
		</div><!-- /.row -->

		<div class="row">
			<div class="col-lg-12"><?php include("layout_alert.php"); ?></div>
		</div>

		<div class="row">
			<div class="col-lg-12">
				<form class="form-horizontal" action="siswa_update.php" method="POST" enctype="multipart/form-data">
					<div class="panel panel-default">
						<div class="panel-heading">
							<h3>Edit Data</h3>
						</div>
						<div class="panel-body">

							<div class="form-group">
								<label class="control-label col-sm-3">Nama Lengkap</label>
								<div class="col-sm-4">
									<input type="text" name="nama_lengkap" class="form-control" placeholder="Nama Lengkap" value="<?php echo $data['nama_lengkap'] ?>" required>
									<input type="hidden" name="siswa" class="form-control" placeholder="ID" value="<?php echo $data['nis'] ?>" required>
								</div>
							</div>

							<div class="form-group">
								<label class="control-label col-sm-3">Kelas</label>
								<div class="col-sm-4">
									<select name="keterangan" id="keterangan" class="form-control" required>
										<option value="">==== Pilih Keterangan ====</option>
										<?php
										$sql_brg = "SELECT kelas.*, tingkatan.* FROM kelas, tingkatan WHERE kelas.id_tingkatan=tingkatan.id_tingkatan and tingkatan.keterangan BETWEEN 'Masuk' and 'Masuk' order by tingkatan.id_tingkatan ASC";
										$ress_brg = mysqli_query($conn, $sql_brg);
										while ($li = mysqli_fetch_array($ress_brg)) {
											echo '<option value="' . $li['keterangan'] . '">' . $li['keterangan'] . '</option>';
										}
										?>
									</select>
								</div>
							</div>


						</div>
						<div class="panel-footer">
							<button type="submit" name="perbarui" class="btn btn-success">Update</button>
						</div>
					</div><!-- /.panel -->
				</form>
			</div><!-- /.col-lg-12 -->
		</div><!-- /.row -->
	</div><!-- /.container-fluid -->
</div><!-- /#page-wrapper -->
<!-- bottom of file -->
<?php
include("layout_bottom.php");
?>