You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PROJET-WEB_STRI1A/WEB/liste_trajets/liste_trajet.php

74 lines
2.1 KiB
PHP

<?php
session_start();
require_once ("../connexionBD.php");
//Si on est pas connecté redirection vers la page de connexion
if (!isset($_SESSION['mail'])) {
header('Location: ../index.php');
exit();
}
$mail = $_SESSION['mail'];
/*
Crée par PALAFFRE Raphael
Fonction: Lister les trajets recherché
Page CSS : liste.css
Donnée en entrée : lieu_depart, lieu_arrivee et date_heure <- recherche.php
Donnée en sortie : $login et $codeTrajet -> contact.php
*/
$source=$_POST['lieu_depart'];
$dest=$_POST['lieu_arrivee'];
$date_depart=$_POST['date_heure'];
$requete="SELECT codeTrajet, dateDepart, dateArrivee, mailProposition FROM Trajet WHERE Trajet.dateDepart=$date_depart AND (SELECT codeTrajet FROM Traverser WHERE nomVille=$source AND nomVille=$dest)=Trajet.codeTrajet;";
$envoi = pg_query($db,$requete);
if ($envoi == FALSE){
echo 'Erreur !';
}
?>
<!DOCTYPE html>
<html lang = "fr">
<head>
<meta charset = "UTF-8">
<link rel = "stylesheet" href = "liste_trajet.css">
<link rel="icon" href="../ressources/favicon.ico" />
<title>Liste des trajets</title>
</head>
<body>
<div id = "container">
<div id ="entete">
<a href = "../tableauBord/tableauBord.php"><img id = "bouton_retour" src = "../resources/return.png" alt = "Bouton retour"></a>
<h1 class = "float" id = "titre">Liste des trajets</h1>
<br>
<h2>Trajets recherchés : <?php echo $source." --> ".$dest; ?></h2>
</div>
<div id = "liste">
<table>
<tr>
<td id="ligne">
<hr class="separation" />
</td>
<td id="info">
<?php echo "$date_depart - $source --> $dest : $login";
//sourcedest recupéré avec le code du trajet, afficher plusieurs avec un while
?>
</td>
<td id="reserver">
<form action="contact.php" method="POST">
<?php
echo "<input type='hidden' name='login' value='$login'/>";
echo "<input type='hidden' name='codeTrajet' value='$codeTrajet'/>";
?>
<input type="submit" value="Reserver">
</form>
</td>
</tr>
</table>
</div>
</div>
</body>
</html>