This repository was archived by the owner on Sep 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCart.php
More file actions
91 lines (67 loc) · 1.8 KB
/
Cart.php
File metadata and controls
91 lines (67 loc) · 1.8 KB
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
<?php session_start() ?>
<!DOCTYPE html>
<html>
<head>
<title>Shopping Cart</title>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
<body background="background1.jpg">
<?php
$pizza=$_POST["valuePizza"]; /* number of pizza */
$sauce=$_POST["sauce"]; /* sauce ID */
?>
<h1>You have selected the following items:</h1>
<?php
if (!isset($_SESSION['pizzaSession'])) {
$_SESSION['pizzaSession']=array();
}
array_push($_SESSION['pizzaSession'], $_SESSION['pizzaSe']); /* collection of pizza pictures */
if (!isset($_SESSION['pizzaNum'])) {
$_SESSION['pizzaNum']=array(); /* collection of amount of pizzas */
}
array_push($_SESSION['pizzaNum'], $pizza);
if (!isset($_SESSION['sauce'])) {
$_SESSION['sauce']=array(); /* collection of sauces */
}
array_push($_SESSION['sauce'], $sauce);
$cou=0; /* counting pizza number */
?>
<div style="display: inline;">
<div style="display: inline-block; float: left; width: 50%;">
<p style="text-align: center;">You selected pizzas:</p>
<?php
foreach ($_SESSION['pizzaSession'] as $key => $value) {
?>
<img src=<?php echo $value ?>>
<?php
echo '<div style="text-align: center;">','<span >Number of Pizzas:</span>', $_SESSION['pizzaNum'][$cou], '</div>';
$cou++;
?>
<br>
<?php
}
?>
</div>
<div style="display: inline-block;">
<p>You selected sauce:</p>
<?php
foreach ($_SESSION['sauce'] as $key => $value) {
?>
<img src=<?php echo $value ?>>
<br>
<?php
}
?>
</div>
</div>
<br>
<br>
<br>
<br>
<br>
<div style="float: left;">
<a href="order.php" style="float: left;">Order another pizza</a>
</div>
<a href="checkout.php" style="float: right;">Check Out</a>
</body>
</html>