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
| <?php
$file = fopen("villes.txt", "r") or exit("Unable to open file!");
echo '<form action="villes.php" method="get">';
echo '<input type ="submit" value="Afficher la météo"/>';
echo '<input type="hidden" name= "fichier">';
echo '<p style="text-align:center"><select multiple="multiple" name = "ville" size="2">';
while(!feof($file))
{
$ligne= fgets($file);
$tok = strtok($ligne, ",");
echo '<option value ='.$test.'>';echo (htmlentities($tok));echo'</option>';
while ($tok == true) {
if ($i==0){
$i=1;
}else
$test=$tok;
$tok = strtok(",");
}
}
echo'</select><p/>';
echo "choix de la ville";
fclose($file);
echo "</form>"
?> |
Partager