-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathproduct-details.php
107 lines (73 loc) · 1.96 KB
/
product-details.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
include_once 'includes/db_connect.php';
$id = $_GET['id'];
?>
<!DOCTYPE html>
<html>
<head>
<title>Product Page</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="styles/styles.css">
<link rel="stylesheet" type="text/css" href="frontEnd.css">
<script src="scripts/jquery.js"></script>
<script src="scripts/modernizr.js"></script>
</head>
<header>
<img src="img/marvel.png" alt="logo">
</header>
<?php
include('main-menu.php');
include('search-nav.php');
?>
<body>
<div class="product clear">
<?php
$sql = "SELECT * FROM product WHERE id = $id";
$result = $mysqli->query($sql);
if ($result->num_rows > 0) {
while($row = mysqli_fetch_array($result))
{
?>
<header>
<hgroup>
<h1 style="color: white;"><?php echo $row['name'] ?></h1>
<h3 style="color: white;"><?php echo $row['color'] ?></h3>
</hgroup>
</header>
<figure>
<img src="<?php echo $row['image'] ?>">
</figure>
<section>
<p>The price is <?php echo $row['price'] ?></p>
<details>
<summary>Product Features</summary>
<ul>
<?php $array = explode(',', $row['description']);
for ($i=0; $i <sizeof($array) ; $i++) {
//print_r($array[$i]);
echo "<li>".$array[$i]."</li>";
}
?>
</ul>
</details>
<a href="add-to-cart.php?id=<?php echo $row['id'] ?>"><button >Add to Cart</button></a>
<?php include('product-rating.php') ;?>
</section>
<?php
}
}
?>
</div>
<script>
if ($('html').hasClass('no-details')) {
var summary = $('details summary');
summary.siblings().wrapAll('<div class="slide"></div>');
$('details:not(.open) summary').siblings('div').hide();
summary.click(function() {
$(this).siblings('div').toggle();
$('details').toggleClass('open');
});
}
</script>
</body>
</html>