botiga_php/productDetail.php

103 lines
3.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
include_once('header.php');
include_once('parameters.php');
if (!(isset($_GET['bp_product_id']))) {
header("Location: home.php");
} else {
$product_id = $_GET['bp_product_id'];
}
$sqlPString = "SELECT bp_product_name, bp_product_info, bp_product_price, bp_product_category, bp_product_img_01, bp_product_img_02, bp_product_img_03, bp_product_addDate, bp_user_name";
$sqlPString .= " FROM bp_products INNER JOIN bp_users WHERE bp_product_owner = bp_user_id AND bp_product_id = ?";
$sqlP = $con->prepare($sqlPString);
$sqlP->bind_param("i", $product_id);
$sqlP->execute();
$sqlP->bind_result($product_name, $product_info, $broduct_price, $product_category, $product_img_01, $product_img_02, $product_img_03, $product_addDate, $product_owner_name);
$sqlP->fetch();
?>
<div class="w3-bar w3-margin"></div>
<div class="w3-bar w3-margin"></div>
<div class="w3-bar w3-margin"></div>
<div class="w3-bar w3-margin"></div>
<!-- Page content -->
<div class="w3-content w3-padding" style="max-width:1564px;margin-top:32px">
<div class="w3-row">
<?php
echo ("
<div class=\"w3-col m5\">
<div class=\"w3-content\" style=\"max-width:800px\">
<img class=\"mySlides\" src=\"img/$product_img_01\" style=\"width:100%\">
<img class=\"mySlides\" src=\"img/$product_img_02\" style=\"width:100%\">
<img class=\"mySlides\" src=\"img/$product_img_03\" style=\"width:100%\">
</div>
<div class=\"w3-center\">
<div class=\"w3-section\">
<button class=\"w3-button w3-light-grey\" onclick=\"plusDivs(-1)\"> Prev</button>
<button class=\"w3-button w3-light-grey\" onclick=\"plusDivs(1)\">Next </button>
</div>
<button class=\"w3-button demo\" onclick=\"currentDiv(1)\">1</button>
<button class=\"w3-button demo\" onclick=\"currentDiv(2)\">2</button>
<button class=\"w3-button demo\" onclick=\"currentDiv(3)\">3</button>
</div>
</div>
<div class=\"w3-col m7 w3-padding\" style=\"max-height: 100vh; overflow: auto;\">
<div class=\"w3-display-container\" style=\"height:100%;\">
<div class=\"w3-display-topleft\">
<div class=\"\">
<h2>$product_name</h2>
</div>
<div class=\"\">
<p>$product_info</p>
</div>
</div>
<div class=\"w3-display-bottomright w3-black w3-padding\">
<p>Publisher: &nbsp; &nbsp; $product_owner_name</p>
</div>
</div>
</div>
");
?>
</div>
</div>
<!-- End page content -->
<script>
var slideIndex = 1;
showDivs(slideIndex);
function plusDivs(n) {
showDivs(slideIndex += n);
}
function currentDiv(n) {
showDivs(slideIndex = n);
}
function showDivs(n) {
var i;
var x = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("demo");
if (n > x.length) {slideIndex = 1}
if (n < 1) {slideIndex = x.length}
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" w3-red", "");
}
x[slideIndex-1].style.display = "block";
dots[slideIndex-1].className += " w3-red";
}
</script>
<?php
include('footer.php');
?>