1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
| <?php
if(isset($_POST['Rechercher']))
{
if ((empty($_POST['nom']))
OR (empty($_POST['prenom']))
OR (empty($_POST['email']))
OR (empty($_POST['telephone'])))
{
echo 'Tous les champs du formulaire doivent être remplis';
}
else
{
$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
$email = $_POST['email'];
$telephone = $_POST['telephone'];
$city = $_POST['city'];
echo'<center><h4>Votre nom est : </h4>' . $nom .'<br>',
' <h4>Votre prénom est : </h4>' . $prenom .'<br>',
' <h4>Votre email est : </h4>' . $email .'<br>',
' <h4>Votre numéro de téléphone est : </h4>' . $telephone .'<br>',
' <h4>Votre ville de départ : </h4>' . $city .'<br></center>';
$travels = array(
array(
'ville1'=>'Paris',
'ville2'=>'Nantes',
'h_deb'=>'11:00',
'h_fin'=>'12:34',
'prenom'=>'Thomas'
),
array(
'ville1'=>'Paris',
'ville2'=>'Orléans',
'h_deb'=>'03:00',
'h_fin'=>'05:26',
'prenom'=>'Clément',
),
array(
'ville1'=>'Paris',
'ville2'=>'Nice',
'h_deb'=>'10:00',
'h_fin'=>'12:09',
'prenom'=>'Audrey',
),
array(
'ville1'=>'Orléans',
'ville2'=>'Nantes',
'h_deb'=>'05:15',
'h_fin'=>'09:32',
'prenom'=>'Mathieu',
),
array(
'ville1'=>'Dublin',
'ville2'=>'Tours',
'h_deb'=>'07:23',
'h_fin'=>'08:50',
'prenom'=>'Nathanael',
),
array(
'ville1'=>'Nice',
'ville2'=>'Nantes',
'h_deb'=>'10:40',
'h_fin'=>'13:00',
'prenom'=>'Pollux',
),
array(
'ville1'=>'Nice',
'ville2'=>'Tours',
'h_deb'=>'11:00',
'h_fin'=>'16:10',
'prenom'=>'Edouard',
),
array(
'ville1'=>'Tours',
'ville2'=>'Amboise',
'h_deb'=>'16:00',
'h_fin'=>'18:40',
'prenom'=>'Priscilla',
),
);
?>
<body>
<center>
<h2>Vos trajets depuis <?php echo $city; ?> :</h2>
<table>
<thead>
<tr>
<th>Départ</th>
<th>Arrivée</th>
<th>Horaires</th>
<th>Prénom</th>
</tr>
</thead>
<?php
foreach($travels as $travel)
{
if ($travel['ville1']==$city)
{
?>
<tbody>
<tr>
<td><?php echo $travel['ville1']; ?></td>
<td><?php echo $travel['ville2']; ?></td>
<td><?php echo $travel['h_deb'].' - '.$travel['h_fin']; ?></td>
<td><?php echo $travel['prenom']; ?></td>
</tr>
</tbody>
</table>
</center>
<?php
}
}
}
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Co tut-tut corp</title>
<link rel="stylesheet" href="style/style.css" media="screen">
</head>
<form method="post" class="formulaire">
<fieldset>
<p class="info">Vos informations personnelles :</p>
<label for name="nom" id="nom"> Votre nom : </label><input type="text" name="nom" required>
<label for name="prenom" id="prenom"> Votre prénom : </label><input type="text" name="prenom" required>
<label for name="email" id="email"> Votre email : </label><input type="text" name="email" required>
<label for name="telephone" id="tel"> Votre téléphone : </label><input type="text" name="telephone" required>
<p>
<label for="ville" class="ville"> Sélection de la ville de départ :</label><br>
<select name="city" class="city">
<option value ="Paris">Paris</option>
<option value ="Orléans">Orléans</option>
<option value ="Dublin">Dublin</option>
<option value ="Nice">Nice</option>
<option value ="Tours">Tours</option>
</select>
</p>
<p id="rechercher" class="center">
<input class="bt" name="Rechercher" type="submit" value="Rechercher">
</p>
</fieldset>
</form>
</body>
</html> |
Partager