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
|
<html>
<head>
<script type="text/javascript">
function getXhr(){
var xmlHttp = null;
if(window.XMLHttpRequest)
xmlHttp = new XMLHttpRequest();
else if(window.ActiveXObject){
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
else {
alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
xmlHttp = false;
}
return xmlHttp
}
function affichetab()
{
var xmlHttp = getXhr()
var reponse = document.getElementById('tab');
var selectEsp = document.getElementById('user');
var selectedEspece = selectEsp.options[selectEsp.selectedIndex].value;
var url = "result.php?";
var data = "user="+selectedEspece; url +=data;
xmlHttp.open("get",url,true);
xmlHttp.onreadystatechange=function()
{if(xmlHttp.readyState==4 && xmlHttp.status==200) {
reponse.innerHTML = xmlHttp.responseText;}}
xmlHttp.send(null);
}
</script>
</head>
<body>
<br />
<?php include('connection.inc.php'); ?>
Sélectionnez :
<select id='user' name='user' onchange="affichetab()">
<option value='-1'>Aucun</option>
<?php
$res = mysql_query("SELECT cp_matriculaire FROM utilisateurs_sites GROUP BY cp_matriculaire ORDER BY cp_matriculaire");
while($row = mysql_fetch_array($res)){
echo "<option>".$row["cp_matriculaire"]."</option>";
}
?>
</select>
<br /><br />
<div id='tab'></div>
</body></html> |
Partager