90 lines
3.4 KiB
PHP
90 lines
3.4 KiB
PHP
<?php
|
|
include_once('header.php');
|
|
include_once('parameters.php');
|
|
|
|
//FILTER BUTTON
|
|
|
|
// if (isset($_POST['submit'])) {
|
|
// $uid = $_POST['uid'];
|
|
// $date = $_POST['date'];
|
|
|
|
// $query = "SELECT * FROM uren WHERE DATUM(post_date)='$date'";
|
|
// $respost = mysqli_query($mysqli, $query);
|
|
// } else {
|
|
// $query = "SELECT * FROM uren";
|
|
// $respost = mysqli_query($mysqli, $query);
|
|
// }
|
|
?>
|
|
|
|
<div class="w3-content w3-padding w3-margin-top" style="max-width:1564px;margin-top:32px">
|
|
<!-- Header -->
|
|
<header class="w3-display-container w3-content w3-wide" style="max-width:1500px;" id="home">
|
|
<img class="w3-image" src="img/banner.jpg" alt="Botiga_php" width="1500" height="400">
|
|
<div class="w3-display-middle w3-margin-top w3-center">
|
|
<h1 class="w3-xxlarge w3-text-white"><span class="w3-padding w3-black w3-opacity-min"><b>Botiga</b></span> <span class="w3-hide-small w3-text-light-grey">php</span></h1>
|
|
</div>
|
|
</header>
|
|
|
|
<div class="w3-container w3-padding-32" id="projects">
|
|
<h3 class="w3-border-bottom w3-border-light-grey w3-padding-16">Products</h3>
|
|
</div>
|
|
|
|
<?php
|
|
include_once('form.php');
|
|
?>
|
|
|
|
<div class="w3-bar w3-margin"></div>
|
|
<div class="w3-bar w3-margin"></div>
|
|
|
|
<div class="w3-row-padding">
|
|
|
|
<?php
|
|
echo ($_POST['search'] . $_POST['category'] . $_POST['minPrice'] . $_POST['maxPrice']);
|
|
$productName = isset($_POST['search']) ? "%" . $_POST['search'] . "%" : "'%%'";
|
|
$productInfo = isset($_POST['search']) ? "%" . $_POST['search'] . "%" : "'%%'";
|
|
$productCategory = ($_POST['category'] != "empty") ? $_POST['category'] : "'%%'";
|
|
$minProductPrice = ($_POST['minPrice'] != "empty") ? $_POST['minPrice'] : 0;
|
|
$maxProductPrice = ($_POST['maxPrice'] != "empty") ? $_POST['maxPrice'] : 999999999999999999;
|
|
|
|
echo ($productName . $productInfo . $productCategory . $minProductPrice . $maxProductPrice);
|
|
|
|
if (empty($_POST)) {
|
|
$sql = $con->prepare("SELECT bp_product_id, bp_product_name, bp_product_price, bp_product_img_01 FROM bp_products");
|
|
|
|
} else {
|
|
$sqlString = "SELECT bp_product_id, bp_product_name, bp_product_price, bp_product_img_01 FROM bp_products";
|
|
$sqlString .= " WHERE (bp_product_name LIKE ? OR bp_product_info LIKE ?)";
|
|
$sqlString .= " AND bp_product_category LIKE ?";
|
|
$sqlString .= " AND (bp_product_price >= ? AND bp_product_price <= ?);";
|
|
|
|
echo ($sqlString);
|
|
|
|
$sql = $con->prepare($sqlString);
|
|
$sql->bind_param("ssidd", $productName, $productInfo, $productCategory, $minProductPrice, $maxProductPrice);
|
|
echo ($sql);
|
|
}
|
|
$sql->execute();
|
|
|
|
$sql->bind_result($bp_product_id, $bp_product_name, $bp_product_price, $bp_product_img_01);
|
|
while ($sql->fetch()) {
|
|
|
|
echo ("
|
|
<div class=\"w3-col l3 m6 w3-margin-bottom\">
|
|
<a href=\"./productDetail.php?bp_product_id=$bp_product_id\">
|
|
<div class=\"w3-display-container\">
|
|
<div class=\"w3-display-topleft w3-black w3-padding\">$bp_product_name</div>
|
|
<div class=\"w3-display-bottomright w3-black w3-padding\">$bp_product_price €</div>
|
|
<img src=\"img/$bp_product_img_01\" alt=\"House\" style=\"width:100%\">
|
|
</div>
|
|
</a>
|
|
</div>
|
|
");
|
|
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
include('footer.php');
|
|
|
|
?>
|