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
| Fichier : index.php
<html>
<head>
<title></title>
<script src="ajax_req.js" type="text/javascript"></script>
</head>
<body>
<form method="post">
<select name="country" onchange="htmlData('city.php', 'ch='+this.value)" />
<?php
$db = mysql_connect('localhost', 'XXX', 'XXXXXX');
mysql_select_db('XXXXXX',$db);
$sql = 'SELECT id,cp FROM cp_ville';
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
while($data = mysql_fetch_assoc($req))
{
echo '<option value="'.$data['cp'].'">'.$data['cp'].'</option>';
}
?>
</select>
<br>
<div id="txtResult"> <select name="cityList"><option></option></select> </div>
<br>
<select name="list_auto_marque" onchange="htmlData2('city.php', 'ch='+this.value)" />
<?php
$db = mysql_connect('localhost', 'XXX', 'XXXXXX');
mysql_select_db('XXX',$db);
$sql2 = 'SELECT id,cp FROM cp_ville';
$req2 = mysql_query($sql2) or die('Erreur SQL !<br>'.$sql2.'<br>'.mysql_error());
while($data2 = mysql_fetch_assoc($req2))
{
echo '<option value="'.$data2['cp'].'">'.$data2['cp'].'</option>';
}
?>
</select>
<br>
<div id="txtResult2"> <select name="list_auto_modele"><option></option></select> </div>
<br>
<select name="3" onchange="htmlData3('city.php', 'ch='+this.value)" />
<?php
$db = mysql_connect('localhost', 'XXX', 'XXXXXX');
mysql_select_db('XXX',$db);
$sql3 = 'SELECT id,cp FROM cp_ville';
$req3 = mysql_query($sql3) or die('Erreur SQL !<br>'.$sql3.'<br>'.mysql_error());
while($data3 = mysql_fetch_assoc($req3))
{
echo '<option value="'.$data3['cp'].'">'.$data3['cp'].'</option>';
}
?>
</select>
<br>
<div id="txtResult3"> <select name="list_auto_modele"><option></option></select> </div>
<input type="submit" />
</form>
</body>
</html> |
Partager