Commit a64e2ba8 by Roy Junedi Simamora

penambahan detail menu, fungsi mengambil session, pesan_proses, dan perubahan pada member_menu

parent 3b22c27f
<?php
include 'common/header.php';
require 'koneksi.php';
?>
<br/>
<a class="btn btn-primary" href="member_menu.php"><span class="glyphicon glyphicon-chevron-left"></span> Kembali</a>
<hr/>
<h3><span class="glyphicon glyphicon-eye-open"></span> Menu Detail </h3>
<div class="row">
<?php
$id = ($_GET['id']);
$det = mysql_query("select * from menu where id_menu ='$id'")or die(mysql_error());
while ($detail = mysql_fetch_array($det)) {
?>
<div class="col-md-6">
<div align="center"><img src="picture/<?php echo $detail['gambar'] ?>" class="img-thumbnail" width="300" height="300"> </div>
</div>
<div class="col-md-6">
<form action="pesan_proses.php?id=<?php echo $id; ?>" action="post">
<table class="table" align="center" width="100%">
<tr>
<td>Nama</td>
<td><?php echo $detail['nama'] ?></td>
</tr>
<tr>
<td>Harga</td>
<td>Rp.<?php echo number_format($detail['harga']) ?>,-</td>
</tr>
<tr>
<td> Kategori </td>
<td>
<?php
if ($detail['kategori_id'] = 1) {
echo 'Makanan';
} else if ($detail['kategori_id'] = 2) {
echo 'Minuman';
}
?>
</td>
</tr>
<tr>
<td> Jumlah </td>
<td> <input type="text" name="jumlah" tabindex="1" size="22" value="1" > </td>
</tr>
<tr>
<td> <input type="submit" class="btn btn-info" value="Pesan"> </td>
</tr>
</table>
</form>
</div>
<?php
}
?>
</div>
<br/>
<?php
include 'common/footer.php';
?>
\ No newline at end of file
<?php
require '/koneksi.php';
function get_session($_key){
$value = (isset($_SESSION[$_key]))? $_SESSION[$_key]: null;
return($value);
}
?>
\ No newline at end of file
......@@ -2,7 +2,7 @@
require 'koneksi.php';
include 'common/header.php';
?>
<h3><span class="glyphicon glyphicon-shopping-cart"></span> Daftar Menu </h3>
<h1><span class="glyphicon glyphicon-shopping-cart"></span> Daftar Menu </h1>
<br/>
<hr/>
......@@ -21,14 +21,15 @@ while ($b = mysql_fetch_array($menu)) {
?>
<div class="col-md-3">
<a href="detail.php?id=<?php echo $b['id_menu'];?>" class="btn btn-lg btn-buy">
<img src="picture/<?php echo $b['gambar'] ?>" class="img-rounded" width="250" height="250">
<div class="caption">
<h4 style="color: #2e6da4;"> <?php echo $b['nama']; ?> </h4>
<h4> <b> <?php echo number_format($b['harga']) ?> </b> </h4>
<hr/>
<a href="pesan.php?id=<?php echo $b['id_menu'] ?>" class="btn btn-info"> <span class="glyphicon glyphicon-shopping-cart"></span> Pesan </a>
<br/> <br/>
<h4 style="color: #3c3c3c;"> <?php echo $b['nama']; ?> </h4>
<h4> <b> Rp. <?php echo number_format($b['harga']) ?>,- </b> </h4>
<br/>
</div>
</a>
</div>
<?php
}
......
<?php
include 'koneksi.php';
include 'fungsi/fungsi.php';
$id = mysql_real_escape_string($_GET['id']);
$query = mysql_query("SELECT * menu WHERE id_menu= '$id'");
$q = mysql_fetch_array($query);
$id_member = get_session('id');
$id_menu = $q['id_menu'];
$tanggal = DATE_COOKIE;
$jumlah = $_POST['jumlah'];
mysql_query("INSERT INTO pemesanan(member_id, menu_id, tanggal, jumlah) VALUES('$id_member','$id_menu','$tanggal','$jumlah')");
header("Location: detail.php?id=".$id);
?>
\ 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