aboutsummaryrefslogtreecommitdiff
path: root/public/product.php
blob: 172a30c9fa763105e3f7af741870d4a04394a4c4 (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
42
43
44
45
<!DOCTYPE html>
<?php require "../lib/db.php"; ?>
<?php
function refuse() {
	http_response_code(404);
	die();
}

$statement = $cursor->prepare("select 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">
				<?php
					$img = "/img/product/".$product->id."-full.jpg";
					echo "<a href='$img'><img src='$img' alt=''></a>";
				?>
			</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="number" value="<?php echo $product->id ?>" hidden name="product_id">
					<input type="submit" value="Toevoegen aan winkelwagen" class="button filled">
				</form>
			</div>
		</div>
	</div>
	<?php include 'footer.php' ?>
</body>
</html>