Commit 951bceb9 by DESKTOP-4R50ASQ\DELL

update menu

parent afa14d10
<?php
session_start();
include_once 'functions/fungsi.php';
include_once 'connection/koneksi.php';
$id = $_GET['id'];
//die($id);
$id_brg = mysql_real_escape_string($_GET['id']);
$det = mysql_query("select * from menu where id='$id_brg'")or die(mysql_error());
while ($d = mysql_fetch_array($det)) {
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Restaurant</title>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css" media="screen" type="text/css">
<link href='http://fonts.googleapis.com/css?family=Pacifico' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Playball' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/style-portfolio.css">
<link rel="stylesheet" href="css/picto-foundry-food.css" />
<link rel="stylesheet" href="css/jquery-ui.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/font-awesome.min.css" rel="stylesheet">
<link rel="icon" href="favicon-1.ico" type="image/x-icon">
</head>
<body>
<!-- ============ Tambah Menu ============= -->
<section id="tambahmenu" class="description_content">
<div class="text-content container">
<div class="inner contact">
<!-- Form Area -->
<div class="contact-form">
<form id="contact-us" method="post" action="update_menu_process.php?id=<?= $d['id'] ?>" enctype="multipart/form-data">
<!-- Left Inputs -->
<div class="container">
<div class="row">
<div class="col-lg-8 col-md-6 col-xs-12">
<div class="row">
<div class="col-lg-8 col-md-6 col-xs-6">
<!-- Name -->
<input type="text" name="nama" id="first_name" required="required" class="form" placeholder="Nama Menu" value="<?php echo $d['nama'] ?>" />
<input type="text" name="harga" id="last_name" required="required" class="form" placeholder="Harga" value="<?php echo $d['harga'] ?>"/>
<input name="deskripsi" id="message" class="form textarea" placeholder="Deskripsi" value="<?php echo $d['deskripsi'] ?>"></input>
<input type="file" name="uploaded_file" class="form" value="<?php echo $d['gambar'] ?>" /></input>
</div>
<div class="col-xs-6 ">
<!-- Send Button -->
<button type="submit" id="submit" name="submit" class="text-center form-btn form-btn">Update</button>
</div>
<div class="col-xs-6 ">
<a href="index.php#olahmenu" class="text-center form-btn btn-danger">Cancel</a>
</div>
</div>
</div>
</div>
</div>
<!-- Clear -->
<div class="clear"></div>
</form>
</div><!-- End Contact Form Area -->
</div><!-- End Inner -->
</div>
</section>
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js" ></script>
<script type="text/javascript" src="js/jquery-1.10.2.js"></script>
<script type="text/javascript" src="js/jquery.mixitup.min.js" ></script>
<script type="text/javascript" src="js/main.js" ></script>
</body>
</html>
<?php
}?>
\ No newline at end of file
<?php
session_start();
include_once 'functions/fungsi.php';
include_once 'connection/koneksi.php';
if (!empty($_FILES['uploaded_file'])) {
$path = "foto/";
$path = $path . basename($_FILES['uploaded_file']['name']);
if (move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $path)) {
echo "The file " . basename($_FILES['uploaded_file']['name']) .
" has been uploaded";
} else {
echo "There was an error uploading the file, please try again!";
}
}
$id = $_GET['id'];
//die($id);
$nama = $_POST['nama'];
$harga = $_POST['harga'];
$deskripsi = $_POST['deskripsi'];
$id_karyawan = get_session('id');
$gambar = basename($_FILES['uploaded_file']['name']);
$sql = "UPDATE menu SET nama='$nama', harga='$harga', deskripsi='$deskripsi', id_karyawan=$id_karyawan, gambar='$gambar' WHERE id=$id";
if ($database->query($sql) === TRUE) {
echo "Record updated successfully";
} else {
echo "Error updating record: " . $database->error;
}
redirect('index.php');
?>
\ 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