-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
55 lines (40 loc) · 1 KB
/
index.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
<?php
require_once 'register.php';
?>
<!DOCTYPE html>
<html>
<head>
<title>Code exercise OOP</title>
</head>
<body>
<?php
include 'product-list.php';
if (!empty($product)) {
if (!empty($product->error)) {
?>
<h2>There was an error with the data source: <?php echo $product->error; ?></h2>
<?php
} else {
?>
<h2><?php echo $product->{$_GET['product_id']}->name ?></h2>
<p><?php echo $product->{$_GET['product_id']}->type ?? '' ?></p>
<hr />
<p><?php echo htmlspecialchars($product->{$_GET['product_id']}->description) ?></p>
<h3>Suppliers</h3>
<ul>
<?php
if(!empty($product->{$_GET['product_id']}->suppliers)) {
foreach ($product->{$_GET['product_id']}->suppliers as $supplier) {
?>
<li><?php echo htmlspecialchars_decode( $supplier) ?></li>
<?php
}
}
?>
</ul>
<?php
}
}
?>
</body>
</html>