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
| <?php
header('Content-type: text') ; // on déclare ce qui va être afficher
// test des POST emis
if(isset($_POST['id']) && !empty($_POST['id']) ){
$user="root";
$host="localhost";
$password="Admin";
$database="db_données";
$connexion = mysql_connect($host,$user,$password);
mysql_select_db($database,$connexion);
$rq="Select * from id_commune where idcat=".$_POST['id']." order by nom;";
$result= mysql_query($rq);
$i=0;
if (mysql_num_rows($result)>0) {
echo "<select size='1' name='m_ville'>";
} else {
echo utf8_encode("Pas de sous catégories disponible");
}
while ($dt=mysql_fetch_row($result)) {
echo "<option value=".utf8_encode($dt[0]).">".utf8_encode($dt[2])."</option><br>";
}
echo "</select>";
}
?> |
Partager