menambahkan fungsi upload, update dan tampilan untuk update

parent 261beb11
<?php
session_start();
include_once('fungsi.php');
if(!isset($_SESSION['admin'])){
header("location: login.php");
}
$nama= mysql_real_escape_string($_GET['id']);
$id = $_GET['id'];
?>
<!DOCTYPE html
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>PENELOLA GIBEON</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/datepicker3.css" rel="stylesheet">
<link href="css/styles.css" rel="stylesheet">
<!--Icons-->
<script src="js/lumino.glyphs.js"></script>
<!--[if lt IE 9]>
<script src="js/html5shiv.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#sidebar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#"><span>GIBEON</span>Admin</a>
<ul class="user-menu">
<li class="dropdown pull-right">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><svg class="glyph stroked male-user"><use xlink:href="#stroked-male-user"></use></svg> User <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="Logout.php"><svg class="glyph stroked cancel"><use xlink:href="#stroked-cancel"></use></svg> Logout</a></li>
</ul>
</li>
</ul>
</div>
</div><!-- /.container-fluid -->
</nav>
<div class="row">
<ol class="breadcrumb">
<li><a href="home.php"><svg class="glyph stroked home"><use xlink:href="#stroked-home"></use></svg></a></li>
<li class="active">Icons</li>
</ol>
</div><!--/.row-->
<?php
$pemesanan=mysql_query("SELECT * FROM pemesanan WHERE id='$id'");
while($p=mysql_fetch_array($pemesanan)){
?>
<form action="updatedata.php" method="POST">
<table>
<tr>
<td width="200px">ID</td>
<td width="150px">:</td>
<td><input type="text" name="id" id="nama" value='<?php echo $p['id'] ?>' readonly> </td>
</tr>
<tr>
<td width="200px">Nama Pengunjung</td>
<td width="150px">:</td>
<td><input type="text" name="nama" id="nama" value='<?php echo $p['namalengkap'] ?>' readonly> </td>
</tr>
<tr>
<td>Alamat Pengunjung</td>
<td>:</td>
<td><input type="text" name="alamat" id="nama" value='<?php echo $p['alamat'] ?>' readonly></td>
</tr>
<tr>
<td>Email Pengunjung</td>
<td>:</td>
<td><input type="text" name="email" id="nama" value='<?php echo $p['email'] ?>' readonly></td>
</tr>
<tr>
<td>Jumlah Peserta</td>
<td>:</td>
<td><input type="text" name="jumlahpeserta" id="nama" value='<?php echo $p['jumlahpeserta'] ?>' readonly></td>
</tr>
<tr>
<td>Tanggal Mulai</td>
<td>:</td>
<td width="300px"><input type="text" name="waktumulai" id="nama" value='<?php echo $p['waktumulai'] ?>' readonly></td>
</tr>
<tr>
<td>Tanggal Selesai</td>
<td>:</td>
<td><input type="text" name="waktuselesai" id="nama" value='<?php echo $p['waktuselesai'] ?>' readonly></td>
</tr>
<tr>
<td>Nama Ruangan</td>
<td>:</td>
<td><input type="text" name="namaruangan" id="namaruangan" required></td>
</tr>
</table>
<input type="submit" name="submit" class="btn btn-info" value="Update">
</form>
<?php
}
?>
</p>
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/chart.min.js"></script>
<script src="js/chart-data.js"></script>
<script src="js/easypiechart.js"></script>
<script src="js/easypiechart-data.js"></script>
<script src="js/bootstrap-datepicker.js"></script>
<script>
$('#calendar').datepicker({
});
!function ($) {
$(document).on("click","ul.nav li.parent > a > span.icon", function(){
$(this).find('em:first').toggleClass("glyphicon-minus");
});
$(".sidebar span.icon").find('em:first').addClass("glyphicon-plus");
}(window.jQuery);
$(window).on('resize', function () {
if ($(window).width() > 768) $('#sidebar-collapse').collapse('show')
})
$(window).on('resize', function () {
if ($(window).width() <= 767) $('#sidebar-collapse').collapse('hide')
})
</script>
\ No newline at end of file
<?php
session_start();
include_once('fungsi.php');
$id = $_POST['id'];
$nama_lengkap = $_POST['nama'];
$alamat = $_POST['alamat'];
$email = $_POST['email'];
$jumlahpeserta = $_POST['jumlahpeserta'];
$waktu_mulai = $_POST['waktumulai'];
$waktu_selesai = $_POST['waktuselesai'];
$namaruangan = $_POST['namaruangan'];
$update2 = mysql_query("UPDATE pemesanan SET namalengkap='$nama_lengkap', alamat='$alamat', email='$email', jumlahpeserta='$jumlahpeserta', waktumulai='$waktu_mulai', waktuselesai='$waktu_selesai', namaruangan='$namaruangan' WHERE id='$id'");
if(!$update2){
echo mysql_error();
}
redirect('Daftar_pesanan.php');
?>
\ No newline at end of file
<?php
include 'config.php';
$id=$_POST['id'];
$nama=$_POST['namalengkap'];
$alamat=$_POST['alamat'];
$email=$_POST['email'];
$waktu_mulai=$_POST['waktumulai'];
$waktu_selesai=$_POST['waktuselesai'];
$namaruangan=$_POST['namaruangan'];
if ($_FILES['gambar']['name']) {
move_uploaded_file($_FILES['gambar']['tmp_name'], 'gambar/'.$nama.'.jpg');
$gambar = 'gambar/'.$nama.'.jpg';
}
$query = mysql_query("update produk set namalengkap='$nama', alamat='$alamat', email='$email', waktumulai='$waktu_mulai', waktuselesai='$waktu_selesai', namaruangan='$namaruangan', gambar='$gambar' where id_produk='$id'");
if($query){
echo "<script>alert('Data $nama berhasil disimpan!'); window.location = 'barang.php'</script>";
}else{
echo "<script>alert('Data $nama gagal disimpan!'); window.location = 'barang.php'</script>";
}
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment