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>
function{
var tabmat = new Array(), tabcat = new Array(), tabspe = new Array();};
function init()
{
document.getElementById('personnel').onchange = function(){
document.getElementById('idmatiere').value = tabmat[this.value];
document.getElementById('idcategorie').value = tabcat[this.value];
document.getElementById('idspe').value = tabspe[this.value];
};
}
</script>
</head>
<body onload = init()>
<form>
<fieldset style="width: 1500px">
<label>personnel</label>
<select id='personnel' onChange="go();">
<option value='0'>Aucune</option>
<?php
mysql_connect("127.0.0.1","root","coquelicot");
mysql_select_db("benjamin");
$res = mysql_query("SELECT * FROM test ORDER BY personnel");
while($row = mysql_fetch_assoc($res))
{
echo "<option value='".$row["id"]. "'>".$row["personnel"]."</option>";
echo '<script type="text/javascript">';
echo "tabmat[". $row["id"] . "] '" . $row["matiere"] . "';";
echo "tabcat[". $row["id"] . "] '" . $row["categorie"] . "';";
echo "tabspe[". $row["id"] . "] '" . $row["spe"] . "';";
echo "</script>\n";
}
?>
</select>
<label> matiere </label>
<input type="text" id="idmatiere" value="<?php echo('matiere'); ?>">
<label> categorie</label>
<input type="text" id="idcategorie" value="<?php echo('categorie'); ?>">
<label> spe </label>
<input type="text" id="idspe" value="<?php echo('spe'); ?>">
</form>
</body>
</html> |