Add the reservation modification feature.
[Project_webapp.git] / includes / formreservations.php
1 <?php
2 $form_flight_id = filter_input(INPUT_POST, "flight_id", FILTER_SANITIZE_STRING);
3 $form_class_name = filter_input(INPUT_POST, "class_name", FILTER_SANITIZE_STRING);
4 $form_cancel = filter_input(INPUT_POST, "cancel", FILTER_SANITIZE_STRING);
5
6 if (isset($form_cancel) && isset($form_flight_id) && isset($form_class_name)) {
7 $client_id = get_client_id($_SESSION['email']);
8 global $connection;
9 $sql_pquery = "delete from RESERVATIONS
10 where NumCl = ? and NumVol = ? and Classe = ?";
11 $connection->prepare_query($sql_pquery);
12 $connection->prepared_query_bind_param("iss", array($client_id, $form_flight_id, $form_class_name));
13 $connection->run_prepared_query();
14 $connection->close_prepared_query();
15 echo "Votre re&#769;servation a e&#769;te&#769; annule&#769;e. <br>";
16 redirect("index.php?page=reservations", 3);
17 } else {
18 echo "Make an error message. <br>";
19 echo "<a href=\"javascript:history.go(-1)\">Retour</a>";
20 }
21
22 ?>