fungsi pencarian

parent 9254886d
<?php
require_once("koneksi.php");
include 'header.php';
global $sql;
$sql = mysqli_query($koneksi, "SELECT * FROM t_artikel ORDER BY tanggal_dibuat DESC limit 8");
?>
<!-- breadcrumbs -->
<div class="breadcrumbs">
......@@ -19,6 +21,21 @@
}
?>
</ol>
<?php
if(isset($_POST['cari'])){
$cari = $_POST['search'];
$sql = mysqli_query($koneksi, "SELECT * FROM t_artikel WHERE judul_artikel LIKE '%$cari%' ORDER BY tanggal_dibuat");
}
?>
<div class="w3l_search">
<form action="" method="post">
<input type="search" name="search" placeholder="Cari Judul Artikel" required="">
<button type="submit" class="btn btn-default search" aria-label="Left Align" name="cari">
<i class="fa fa-search" aria-hidden="true"> </i>
</button>
<div class="clearfix"></div>
</form>
</div>
</div>
</div>
<!-- //breadcrumbs -->
......@@ -27,7 +44,6 @@
<div class="container">
<div class="agile_top_brands_grids">
<?php
$sql = mysqli_query($koneksi, "SELECT * FROM t_artikel ORDER BY tanggal_dibuat DESC limit 8");
while($data = mysqli_fetch_array($sql)){
?>
<div class="col-md-6 top_brand_left">
......
<?php
require_once("koneksi.php");
include 'header.php';
global $sql;
$sql = mysqli_query($koneksi, "SELECT * FROM t_buku ORDER BY isbn ASC LIMIT 24");
?>
<!-- breadcrumbs -->
<div class="breadcrumbs">
......@@ -10,15 +12,30 @@
if (isset($_SESSION['pengunjung'])) {
echo '
<li><span><i class="fa fa-sign-in" aria-hidden="true"></i><a href="login.php"> Masuk</a></span></li>
<li class="active">Keranjang Belanja</li> ';
<li class="active">Daftar Buku</li> ';
}
else {
echo '
<li><a href="index.php"><span class="glyphicon glyphicon-home" aria-hidden="true"></span>Beranda</a></li>
<li class="active">Keranjang Belanja</li> ';
<li class="active">Daftar Buku</li> ';
}
?>
</ol>
<?php
if(isset($_POST['cari'])){
$cari = $_POST['search'];
$sql = mysqli_query($koneksi, "SELECT * FROM t_buku WHERE judul LIKE '%$cari%' ORDER BY isbn");
}
?>
<div class="w3l_search">
<form action="" method="post">
<input type="search" name="search" placeholder="Cari Judul Buku" required="">
<button type="submit" class="btn btn-default search" aria-label="Left Align" name="cari">
<i class="fa fa-search" aria-hidden="true"> </i>
</button>
<div class="clearfix"></div>
</form>
</div>
</div>
</div>
<!-- //breadcrumbs -->
......
......@@ -6,8 +6,6 @@
session_destroy();
header('location: index.php');
};
global $sql;
$sql = mysqli_query($koneksi, "SELECT * FROM t_buku ORDER BY isbn ASC LIMIT 24");
?>
<!DOCTYPE html>
......@@ -103,21 +101,6 @@
<div class="w3ls_logo_products_left">
<h1><a href="about.php">Toko Buku Cemerlang</a></h1>
</div>
<?php
if(isset($_POST['cari'])){
$cari = $_POST['search'];
$sql = mysqli_query($koneksi, "SELECT * FROM t_buku WHERE judul LIKE '%$cari%' ORDER BY isbn");
}
?>
<div class="w3l_search">
<form action="" method="post">
<input type="search" name="search" placeholder="Cari Judul Buku" required="">
<button type="submit" class="btn btn-default search" aria-label="Left Align" name="cari">
<i class="fa fa-search" aria-hidden="true"> </i>
</button>
<div class="clearfix"></div>
</form>
</div>
<div class="clearfix"> </div>
</div>
</div>
......
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