-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecap.php
49 lines (49 loc) · 1.47 KB
/
recap.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
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Recap of the product</title>
</head>
<body>
<!-- <?php var_dump($_SESSION); ?> -->
<?php
if(!isset($_SESSION['products']) || empty($_SESSION['products'])){
echo "<p>Aucun produit en session...</p>";
}
else{
echo "<table>",
"<thead>",
"<tr>",
"<th>#</th>",
"<th>Nom</th>",
"<th>Prix</th>",
"<th>Quantite</th>",
"<th>Total</th>",
"</tr>",
"</thead>",
"<tbody>";
$totalGeneral = 0;
foreach($_SESSION['products'] as $index => $product){
echo "<tr>",
"<td>".$index."</td>",
"<td>".$product['name']."</td>",
"<td>".number_format($product['price'], 2, ",", " ")." €</td>",
"<td>".$product['qqt']."</td>",
"<td>".number_format($product['total'], 2, ",", " ")." €</td>",
"</tr>";
$totalGeneral +=$product['total'];
}
echo "<tr>",
"<td colspan=4>Total general :</td>",
"<td><strong>".number_format($totalGeneral, 2, ",", " ")." €</strong></td>",
"</tr>",
"</tbody>",
"</table>";
}
?>
</body>
</html>