summaryrefslogtreecommitdiffstats
path: root/productdetails.php
blob: 44f3e04e23b91e313e6c2135018942d6b494111f (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
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
<?php
session_start();
if(isset($_GET['id']))
{
	$id = $_GET['id'];
}
else
{
	header('Location: categories.php');
}
if(isset($_GET['catid']))
{
	$catid = $_GET['catid'];
}
require_once('vendor.inc.php');

$product = ProductQuery::create()->findOneById($id);

if ( !is_object($product) )
{
	header('Location: categories.php');
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Productdetails</title>
<link rel="stylesheet" type="text/css" href="styles/style.css">
</head>
<body>
	<header><h1><?php echo $product->getName(); ?></h1></header>
	<nav>
		<dl>
			<dt><a href="contact.php">Contact us</a></dt>
			<dt><a href=".">Home</a></dt>
			<dt><a href="categories.php">Categories</a></dt>
			<dt><a href="products.php?id=<?php echo $catid; ?>">Back to Category</a></dt>
			<?php
				if(isset($_SESSION['username']))
				{
					echo "<dt><a href=\"login.php?logout\">Logout</a></dt>";
				}
				else
				{
					echo "<dt><a href=\"login.php\">Login</a></dt>";
				}
			?>
		</dl>
	</nav>
	<div id="content">
		<form>
			<div class="row">
				<label for="name"><u>N</u>ame:</label>
				<input class="formw" type="text"
					placeholder="Name" id="name" name="name" accesskey="n"
					maxlength="100" readonly value="<?php echo $product->getName(); ?>">
			</div>
			<div class="row">
				<label for="price"><u>P</u>rice (Euro):</label>
				<input class="formw" type="text"
					placeholder="Price (Euro)" id="price" name="price" accesskey="p"
					maxlength="13" readonly value="<?php echo $product->getPrice(); ?>">
			</div>
			<div class="row">
				<label for="width"><u>W</u>idth (mm):</label>
				<input class="formw" type="text"
					placeholder="Width (mm)" id="width" name="width" accesskey="w"
					maxlength="11" readonly value="<?php echo $product->getWidth(); ?>">
			</div>
			<div class="row">
				<label for="height"><u>H</u>eight (mm):</label>
				<input class="formw" type="text"
					placeholder="Height (mm)" id="height" name="height" accesskey="h"
					maxlength="11" readonly value="<?php echo $product->getHeight(); ?>">
			</div>
			<div class="row">
				<label for="desc"><u>D</u>escription:</label>
				<textarea class="formw" placeholder="Description" id="desc" name="desc"
					accesskey="d" maxlength="1000" readonly rows="5"><?php echo $product->getDescription(); ?></textarea>
			</div>
			<div class="spacer">&nbsp;</div>
		</form>
		<div class="spacer"></div>
	</div>
	<footer>Copyright by SomeCompany Ltd.</footer>
</body>
</html>