Commit | Line | Data |
---|---|---|
c49f7219 JB |
1 | <?php |
2 | $form_flight_id = filter_input(INPUT_POST, "flight_id", FILTER_SANITIZE_STRING); | |
3 | $form_nb_place = filter_input(INPUT_POST, "nb_place", FILTER_VALIDATE_INT); | |
4 | $form_class_name = filter_input(INPUT_POST, "class_name", FILTER_SANITIZE_STRING); | |
5 | ||
8d17cae3 JB |
6 | $input_failure = false; |
7 | ||
8 | if (!$form_nb_place) { | |
9 | echo "Nombre de place(s) invalide. <br>"; | |
10 | $input_failure = true; | |
11 | } | |
12 | ||
13 | if (!$input_failure && !empty($form_nb_place) && !empty($form_class_name)) { | |
14 | global $connection; | |
15 | $client_id = get_client_id($_SESSION['email']); | |
16 | $sql_pquery = "update RESERVATIONS | |
c49f7219 JB |
17 | set NbPlaces = ?, Classe = ? |
18 | where NumCl = ? and NumVol = ?"; | |
8d17cae3 JB |
19 | $connection->prepare_query($sql_pquery); |
20 | $connection->prepared_query_bind_param("isis", array($form_nb_place, $form_class_name, $client_id, $form_flight_id)); | |
21 | $connection->run_prepared_query(); | |
22 | $connection->close_prepared_query(); | |
23 | echo "Modifications enregistrées. <br>"; | |
24 | redirect("index.php?page=reservations", 3); | |
25 | } else { | |
26 | echo "Make an error message. <br>"; | |
27 | echo "<a href=\"javascript:history.go(-1)\">Retour</a>"; | |
28 | } | |
29 | ||
c49f7219 | 30 | ?> |