if (preg_match('#quantite#', $key) === 1) { if (!empty($_POST[$key])) { array_push($quantites, $value); } } } } } $prixFinal = 0; for ($i = 0; $i < sizeof($quantites); $i++) { $requeteTypes->execute(array($types[$i][1])); $type = $requeteTypes->fetchAll(); foreach ($type as $t) { $t = $t['libTypeBillet']; } $requeteMatchs->execute(array($types[$i][0])); $match = $requeteMatchs->fetchAll(); foreach ($match as $m) { $m = $m['day']; } $requetePrix->execute(array($types[$i][0], $types[$i][1])); $prix = $requetePrix->fetchAll(); foreach ($prix as $p) { $p = $p['prix']; } $total = $p * $quantites[$i]; $page->appendContent("<p>{$quantites[$i]} billet(s) {$t} pour le match du {$m}. Prix : " . number_format($total, 2, ",", ".") . " €</p>"); $prixFinal += $total; } $page->appendContent("<hr>\n\t\t\t\t\t<div id='codePromo'>\n\t\t\t\t\t\t<input type='text' placeholder='Code Promo'/>\n\t\t\t\t\t\t<input type='button' value='Valider'/>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div id='codeLicence'>\n\t\t\t\t\t\t<input type='text' placeholder='Code Licence'/>\n\t\t\t\t\t\t<input type='button' value='Valider'/>\n\t\t\t\t\t</div>\n\t\t\t\t\t<hr>\n\t\t\t\t\t<p>Total : " . number_format($prixFinal, 2, ',', '.') . " €</p>"); echo $page->toHTML();
<?php require_once "../config/config_base.php"; require_once CONFIG_DIR . "/config_db.php"; require_once INC_DIR . "/autoload.function.php"; $page = new WebPage("Billetterie"); $page->appendJsUrl("../lib/jquery.js"); $page->appendJsUrl("../js/billetterie.js"); $page->appendCssUrl("../css/index.css"); $html = "<form id='billets' method='POST' action='validationAchat.php'></form>"; $page->appendContent($html); echo $page->toHTML();