botiga_php/productDetail.php

89 lines
2.8 KiB
PHP
Raw Normal View History

2021-12-09 15:17:30 +01:00
<?php
include_once('header.php');
include_once('parameters.php');
if (!(isset($_GET['bp_product_id']))) {
header("Location: home.php");
} else {
$bp_product_id = $_GET['bp_product_id'];
}
$sqlP = $con->prepare("SELECT * from bp_products where bp_product_id = ?");
$sqlP->bind_param("i", $bp_product_id);
$sqlP->execute();
$sqlP->bind_result($bp_product_id, $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);
$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/$bp_product_img_01\" style=\"width:100%\">
<img class=\"mySlides\" src=\"img/$bp_product_img_02\" style=\"width:100%\">
<img class=\"mySlides\" src=\"img/$bp_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\">
<h2>$bp_product_name</h2>
<p>$bp_product_info</p>
</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');
?>