2 $flight_id = filter_input(INPUT_GET
, "flight_id", FILTER_SANITIZE_STRING
);
3 $class_name = filter_input(INPUT_GET
, "class_name", FILTER_SANITIZE_STRING
);
4 $client_id = get_client_id($_SESSION['email']);
5 echo "<h1> Modification de la réservation sur le vol $flight_id</h2>\n";
7 $sql_pquery = "select NumCl, NumVol, Classe, NbPlaces
9 where NumCl = ? and NumVol = ? and Classe = ?";
10 $connection->prepare_query($sql_pquery);
11 $connection->prepared_query_bind_param("iss", array($client_id, $flight_id, $class_name));
12 $connection->run_prepared_query();
13 $connection->get_pquery_result();
14 $rows = $connection->get_result_array();
15 $connection->close_prepared_query();
17 <form action
="index.php" id
="modify" method
="post">
18 <input type
="hidden" name
="form" value
="modify" />
19 <input type
="hidden" name
="flight_id" value
="<?php echo $rows[0]['NumVol'] ?>" />
20 <label
> Nombre de
place(s
) : </label
>
21 <input type
="number" name
="nb_place" min
="1" max
="9" value
="<?php echo $rows[0]['NbPlaces'] ?>" required
/>
22 <label
> Classe
: </label
>
23 <select size
="1" name
="class_name" required
>
24 <optgroup label
="Sélectionner une classe">
26 $sql_pquery = "select distinct Classe from DEFCLASSES where NumVol = ?";
28 $connection->prepare_query($sql_pquery);
29 $connection->prepared_query_bind_param("s", array($flight_id));
30 $connection->run_prepared_query();
31 $connection->get_pquery_result();
32 $classes = $connection->get_result_array();
33 $connection->close_prepared_query();
34 foreach ($classes as $class) {
35 if (strcmp($class[0], $rows[0]['Classe']) === 0) {
36 echo "<option value=\"$class[0]\" selected>$class[0]</option>\n";
38 echo "<option value=\"$class[0]\">$class[0]</option>\n";
44 <input type
="submit" value
="Valider">