Pb empty php

Fermé
arez - 21 mai 2009 à 00:55
 arez - 21 mai 2009 à 01:05
Bonjour,
voila mon probleme je n'arrive pas a faire cet exercice
(Bouton à sélection multiple
Ecrivez un fichier mult.html contenant des «checkbox» proposant différents choix. Ecrivez ensuite un fichier PHP
permettant d’afficher les textes qui correspondent à l’ensemble des boutons sélectionnés.)

voila mon essai alor ma pages html:

<html>
<head>
<title> Séance 5 Exercice 5 </title>
</head>
<body>
<p> Pour vos prochaine vacances vous souhaitez aller : </p>
<form method="POST" action="exo5.php">
<ul>
<li> <input type="checkbox" name="c1" value="1"> aux Bahamas </li>
<li> <input type="checkbox" name="c1" value="2"> en Italie </li>
<li> <input type="checkbox" name="c1" value="3"> en Chine </li>
</ul>
<input type="submit" value="Clickez !">
</form>
</body>
</html>

puis ma pages php

<html>
<head>
<title> Séance 5 Exercice 5 </title>
</head>
<body>
<?php
if(!empty($_POST["c1"])){
echo "<p> vous souhaitez aller aux Bahamas !!</p>";
}
if(!empty($_POST["c2"])){
echo "<p> vous souhaitez aller en Italie !!</p>";
}
if(!empty($_POST["c3"])){
echo "<p> vous souhaitez aller en Chine !!</p>";
}
if(empty($_POST["c1"]) && empty($_POST["c2"]) && empty($_POST["c3"])){
echo "<p> OK pas de vacances !!</p>";
}
?>
</body>
</html>
A voir également:

2 réponses

Bonjour

Tu as appelé tes 3 checkbox c1...
0
effectivement merci
0