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 62 63 64 65 66
| <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Acquisition species variant</title>
<head>
<script type="text/javascript">
function request05(liste)
{
var l1 = f.elements["list1"];
var l2 = f.elements["list2"];
var index = l1.selectedIndex;
if(index < 1)
l2.options.length = 0;
else {
var xhr_object = null;
if(window.XMLHttpRequest) // Firefox
xhr_object = new XMLHttpRequest();
else if(window.ActiveXObject) // Internet Explorer
xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
else { // XMLHttpRequest non supporté par le navigateur
alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
return;
}
xhr_object.open("POST", "test2.php", true);
xhr_object.onreadystatechange = function() {
if(xhr_object.readyState == 4)
eval(xhr_object.responseText);
}
xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
var data = "speciesvariant_name="+escape(l1.options[index].value)+"&form="+f.name+"&select=list2";
xhr_object.send(data);
}
}
</script>
</head>
<body>
<form name="enter_nvll_xp_choix" action="Entree_dans_la_bdd/enter_DB_experience.php" method="POST">
<?php
mysql_connect("localhost", "root", "");
mysql_select_db("test");
$experience = mysql_query("SELECT * FROM speciesvariant");
echo '<tr><td>Test listes liees:</td>';
echo '<td><select name="list1" id="list1" class="ButtonL" onchange="request05(this.form)">';
echo '<option value="" selected disabled>Choix</option>';
while ($speciesvariant_name1 = mysql_fetch_array($experience))
{
$speciesvariant_name2 = $speciesvariant_name1['speciesvariant_name'];
echo "<option value=\"$speciesvariant_name2\"> $speciesvariant_name2 </option>";
}
//echo '</select>';
echo '</td><td><select name="list2" id="list2" class="ButtonL"></td>';
/*---------------------------------------------------------------------*/
mysql_close();
?> |
Partager