Bonjour,
J'ai une base de donnée agents (matricule, nom et téléphone) et un formulaire que je dois remplir avec les 3 champs. le champ agent est une combo box qui appelle la liste des agents.
Quand je choisie un agent son matricule et son telephone doivent s'afficher dans les 21 autres champs.
J'ai dans ma balise :
<script>
function actuagent(){
document.insertion.matricule.value = document.insertion.agents.value;
document.insertion.telephone.value = document.insertion.agents.value;
}
</script>
et dans mon formulaire en rouge la combo box et les autres champs:
<form name="insertion"
action="agent_insertok.php"
method="POST" class="Style6"
onsubmit = 'return controlegeneral()';>
<table width="100%" height="501" border="0" align="right" cellpadding="4" cellspacing="1">
<tr>
<td></td>
<td colspan="3" valign="middle"><b>
<input name="date" type="hidden" id="date" value="<?php print $date; ?>" />
</b></td>
</tr>
<tr>
<td width="38%"><div align="right"><strong>Heure : </strong></div></td>
<td colspan="3"><input name="heure" type="text" id="heure" value="<?php print $heure; ?>" size="8" maxlength="6" /></td>
</tr>
<tr>
<td><div align="right"><strong>Matricule : </strong></div></td>
<td colspan="3" valign="middle"><input name="matricule" type="text" id="matricule" style='width:200px' readonly=true /></td>
</tr>
<tr>
<td><div align="right"><strong>Agents : </strong></div></td>
<td colspan="3" valign="middle"><select name=agents size=1 onchange='actuagent()' style='width:200px'>
<option selected>Choisir un agent</option >
<?php connexion_listecombobox('SELECT matricule, nom, telephone FROM agents ORDER BY nom ASC', ''); ?>
</select></td>
</tr>
<tr>
<td><div align="right"><strong>Téléphone : </strong></div></td>
<td><input name="telephone" type="text" id="telephone" style='width:200px' readonly=true /></td>
</tr><tr>
<td><div align="right"><strong>Service : </strong></div></td>
<td colspan="3"><select name="service" size="1" id="service">
<option selected>Choisir un service</option >
<?php connexion_listecombobox('select nom, nom from service', ''); ?>
</select>
</td>
</tr>
<tr>
<td><div align="right"><strong>Portable : </strong></div></td>
<td colspan="3"><select name="portable" size="1" id="portable">
<option value="">Faite votre choix</option>
<option value="Talkie">Talkie</option>
<option value="PAP">PAP</option></select>
</td>
</tr>
<tr>
<td><div align="right"><strong>N° : </strong></div></td>
<td><input name="numero" type="text" id="numero" maxlength="5" /></td>
</tr>
<tr>
<td><div align="right"><strong>Lieu : </strong></div></td>
<td colspan="3"><select name="attachement" size="1" id="attachement" style="width:200px">
<option value="">Faite votre choix</option>
<?php
connexion_listecombobox('select attachement, attachement from attachement', '');
?>
</select></td>
</tr>
<tr>
<td height="29"> </td>
<td colspan="3"><input name="agentliaison" type="hidden" id="agentliaison" value="<?php print $_SESSION['nom'];?>" />
<input name="matricule2" type="hidden" id="matricule2" value="<?php print $_SESSION['matricule']; ?>" /></td>
</tr>
<tr>
<td height="32" colspan="2"><div align="center">
<input type="submit" name="Submit" value="Envoyer" />
</div></td>
</tr>
</table>
</form>
Povez vous m'aider à comprendre pour quoi çà ne fonctionne pas
Merci