<?php
	require_once("koneksi.php");
    include 'header.php';
?>

<!-- checkout -->
	<div class="checkout">
		<div class="container">
			<center><h2>TERIMAKASIH TELAH BERBELANJA DI TOKO BUKU CEMERLANG</h12</center>	
			
			<div class="col-md-12 checkout-left">	
				<div class="checkout-left-basket">
					<h4>Struk Pemesanan</h4>
					<?php
						$total = 0;
						if (isset($_SESSION['items'])) {
						    foreach ($_SESSION['items'] as $key => $val) {
						        $query = mysqli_query($koneksi, "SELECT * FROM t_buku WHERE isbn = '$key'");
							    $data = mysqli_fetch_array($query);

							    $jumlah_harga = $data['harga'] * $val;
							    $total += $jumlah_harga;
							    $no = 1;
					?>
					<ul>
						<li><?php echo $data['judul']; ?><i> - </i> <span>Rp.<?php echo number_format($data['harga'],2,",",".");?></span></li>
					<?php
							}
					?>
						<li>Potongan Harga<span> - </span></li>
						<li>Total Harga <i>-</i> <span>Rp.<?php echo number_format($total); ?>,00</span></li>
					</ul>
					<?php
						}
					?>
					<?php
					if (isset($_SESSION['items'])) {
						    foreach ($_SESSION['items'] as $key => $val) {
						        $query = mysqli_query($koneksi, "INSERT INTO t_pemesanan WHERE isbn = '$key'");
							    $data = mysqli_fetch_array($query);

							    
					?>

				</div>
				<div class="clearfix"> </div>
			</div>
		</div>
	</div>
<!-- //checkout -->

<?php
	include 'footer.php';
?>