<?php
if (!$input_failure) {
global $connection;
- $sql_pquery = "select VOLS.NumVol as NumVol, VilleD, DateD, VilleA, DateA, Classe, round(CoutVol*CoeffPrix, 2) as Prix, NumAv from VOLS, DEFCLASSES
+ $sql_pquery = "select VOLS.NumVol as NumVol, VilleD, DateD, VilleA, DateA, Classe, round(CoutVol*CoeffPrix, 2) as Prix, NumAv
+ from VOLS, DEFCLASSES
where DEFCLASSES.NumVol = VOLS.NumVol and
DateD >= ? and VilleD = ? and DateA <= ? and VilleA = ?
order by DateD, NumVol, Prix";
if (empty($rows)) {
echo "Aucun vol ne correspond aux critères de recherche. <br>";
} else {
+ if ($action === "return_flight" && isset($_SESSION['return_flight_nb_place'])) {
+ $nb_places = $_SESSION['return_flight_nb_place'];
+ unset($_SESSION['return_flight_nb_place']);
+ } else {
+ $nb_places = 1;
+ }
echo "<table id=\"search\">\n";
echo " <tr>\n";
echo " <th>Numéro de vol</th>\n";
<input type=\"hidden\" name=\"class_name\" value=\"" . $row['Classe'] . "\" />
<input type=\"hidden\" name=\"place_price\" value=\"" . $row['Prix'] . "\" />
<label> Place(s) : </label>
- <input type=\"number\" name=\"nb_place\" min=\"1\" max=\"9\" value=\"1\" required/>
- <label> Vol retour : </label>\n";
+ <input type=\"number\" name=\"nb_place\" min=\"1\" max=\"9\" value=\"" . $nb_places . "\" required/>\n";
if (!($action === "return_flight")) {
+ echo " <label> Vol retour : </label>\n";
echo " <input type=\"checkbox\" name=\"return_flight\" checked/>\n";
}
echo " <input type=\"submit\" value=\"Réserver\">\n";