-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
122 lines (116 loc) · 4.48 KB
/
Copy pathindex.php
File metadata and controls
122 lines (116 loc) · 4.48 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
require 'header.php';
require_once 'function.php';
$chemise = [
"Hermes" => 15,
"Gucci" => 45,
"Luis Vuiton" => 25,
];
$bas = [
"Culotte" => 26,
"Pantalon" => 24,
];
$bas_marque = [
"LaCoste" => 48,
"Dolces" => 23,
"Amiri" => 14,
];
$item = 0;
$item2 = 0;
$item3 = 0;
$data_chemise = 0;
$data_bas = 0;
$pan_chemise = null;
$pan_bas = null;
$pan_radio = null;
$radio_data = 0;
if (isset($_POST["item_chemise"])) {
$data_chemise = result($_POST["item_chemise"]);
$pan_chemise = result_data($_POST["item_chemise"]);
$table_ch = result_data($_POST["item_chemise"]);
};
if (isset($_POST["item_bas_marque"])) {
$data_bas = result($_POST["item_bas_marque"]);
$pan_bas = result_data($_POST["item_bas_marque"]);
$table_ch2 = result_data($_POST["item_bas_marque"]);
};
if (isset($_POST["item_bas"])) {
$radio_data = result($_POST["item_bas"]);
$pan_radio = result_data($_POST["item_bas"]);
$table_bas = result_data($_POST["item_bas"]);
};
?>
<div>
<form class="magasin" action="/index.php" method="POST">
<fieldset>
<label>Mon Magasin</label> <br> <br>
<fieldset>
<label>Chemise</label> <br>
<?php foreach ($chemise as $cle => $valeur): ?>
<input type="checkbox" name="item_chemise[<?= $cle ?>]" id="<?= $cle ?>" value="<?= $valeur ?>">
<label for="<?= $cle ?>"><?= $cle ?> - <?= $valeur ?> €</label> <br>
<?php endforeach ?>
</fieldset><br>
<fieldset>
<label>Bas</label> <br>
<?php foreach ($bas as $cle => $valeur): ?>
<input type="radio" name="item_bas[<?= $cle ?>]" id="<?= $cle ?>" value="<?= $valeur ?>">
<label for="<?= $cle ?>"><?= $cle ?> - <?= $valeur ?> €</label> <br>
<?php endforeach ?>
</fieldset> <br>
<fieldset>
<label>Bas Marques</label> <br>
<?php foreach ($bas_marque as $cle => $valeur): ?>
<input type="checkbox" name="item_bas_marque[<?= $cle ?>]" id="<?= $cle ?>" value="<?= $valeur ?>">
<label for="<?= $cle ?>"><?= $cle ?> - <?= $valeur ?> €</label> <br>
<?php endforeach ?>
</fieldset> <br> <br>
<button class="custom-button" type="submit">Voir mon Panier</button>
</fieldset>
</form>
</div>
<div>
<table>
<?php if (isset($table_ch) || isset($table_ch2) || isset($table_bas)): ?>
<tr class="head_tb">
<td>Produit</td>
<td>Prix</td>
</tr>
<?php endif ?>
<?php if (isset($table_ch)): ?>
<?php $item = count($table_ch); ?>
<?php foreach ($table_ch as $k => $v): ?>
<tr>
<td><?=$k?></td>
<td><?=$v?> €</td>
</tr>
<?php endforeach ?>
<?php endif ?>
<?php if (isset($table_ch2)): ?>
<?php $item2 = count($table_ch2); ?>
<?php foreach ($table_ch2 as $k => $v): ?>
<tr>
<td><?=$k?></td>
<td><?=$v?> €</td>
</tr>
<?php endforeach ?>
<?php endif ?>
<?php if (isset($table_bas)): ?>
<?php $item3 = count($table_bas); ?>
<?php foreach ($table_bas as $k => $v): ?>
<tr>
<td><?=$k?></td>
<td><?=$v?> €</td>
</tr>
<?php endforeach ?>
<?php endif ?>
<?php if (isset($table_ch) || isset($table_ch2) || isset($table_bas)): ?>
<tr class="foot">
<td>Total</td>
<td><?=($data_chemise + $data_bas + $radio_data)?> €</td>
</tr>
<?php endif ?>
</table>
<div class="alert">Votre panier fait <?=($data_chemise + $data_bas + $radio_data)?> € | <?=($item + $item2 + $item3)?> Items</div>
</div>
<?php require 'footer.php' ?>