aboutsummaryrefslogtreecommitdiff
path: root/public/product.php
blob: 3e6a89f75b006e0c22ba59d64b0c970b25efd1b2 (plain)
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
<!DOCTYPE html>
<?php require "db.php"; ?>
<?php
function refuse() {
	http_response_code(404);
	die();
}

$statement = $cursor->prepare("select ID as id, image, price, name, description from webs.product where ID = ?");
$statement->bind_param("i", $_GET['id']);
if (!$statement->execute()) refuse();
$res = $statement->get_result();
if (!mysqli_num_rows($res)) refuse();
$product = $res->fetch_object();
?>
<html>
<head>
	<?php include 'head.php' ?>
	<title>dit is product</title>
	<link rel='stylesheet' type='text/css' media='screen' href='product.css'>
</head>
<body>
	<?php include 'navbar.php' ?>
	<div class="main limwidth">
		<div class="twocolumn">
			<div class="column left">
				<img src="<?php echo "/img/product/".$product->id."-thumb.jpg" ?>" alt="">
			</div>
			<div class="column right">
				<h2><?php echo $product->name ?></h2>
				<span class="price"><?php echo $product->price ?></span>
				<span class="info"><?php echo $product->description ?></span>
				<form action="/cart.php" method="post">
					<input type="submit" value="Toevoegen aan winkelwagen">
				</form>
			</div>
		</div>
	</div>
	<?php include 'footer.php' ?>
</body>
</html>