Bonjour,
Voilà après avoir récupérer l'identifiant de ma table par un click dans mon tableau de donnée, je voudrais récupérer les autres données de ma table et les affecter dans mes input.
Voici le code de ma page: localite.php
<form name="localite_mod" action = "resultat_rens_localite.php" method="post">
<div id="loc_id_txt"></div>
<TABLE width="100%" border=0 >
<td valign="top" width="55%" ><center> <font face="arial" size="4" color="red"><big><b><u>Gestion des localités</u></b></font> <br><br><br><br>
<table >
<tr>
<TD> <font color=black size="4"><b>Code localité :</b></font></TD>
<TD> <input type="text" value="" name="code_localite" id="code_localite" size="6"/>
<input type="hidden" value="" name="codeloc_id" id="codeloc_id" size="6" /> </TD>
<TD> <font color=black size="4"><b>Localite:</b></font></TD>
<TD> <input type="text" value="" name="localite" id="localite" size="25"/>
<input type="hidden" value="" name="loc_id" id="loc_id" size="25"/> </TD>
</tr>
<tr>
<TD><font color=black size="4"><b>Code Postal :</b></font></TD>
<TD> <input type="text" name="code" size="5"></TD>
<TD><font color=black size="4"><b>Pays :</b></font></TD>
<TD> <input type="text" name="pays" size="25"></TD>
</tr>
</table>
<iframe src="Frame_Localite_Liste.php" name="iframe1" width="500" height="420" > </iframe>
Voici le code de ma page: Frame_Localite_Liste.php puisse que mon tableau ce situe dans une iframe
<?php
include ("connexion_db.php");
$sql = 'select * from tlocalite ';
$result = mysql_query($sql) or die("Erreur SQL !");
$NEnregistrement = mysql_num_rows($result);
?>
<tr>
<td width=20% ><FONT color=green FACE=\"comic sans ms\" SIZE='+1'>Code</font> </td>
<td width=40% ><FONT color=green FACE=\"comic sans ms\" SIZE='+1'>Localite</font></td>
<td width=25% ><FONT color=green FACE=\"comic sans ms\" SIZE='+1'>Code postal</font></td>
<td width=15% ><FONT color=green FACE=\"comic sans ms\" SIZE='+1'>Pays</font></td>
</tr>
<script type="text/javascript">
function setInfo(_id, _name)
{
parent.document.getElementById("code_localite").value = _name;
parent.document.getElementById("codeloc_id").value = _id;
}
</script>
<?php
//affichage du tableau dynamique
for ($Compteur = 0 ; $Compteur < $NEnregistrement ; $Compteur ++)
{
echo "<tr onMouseover=this.bgColor='#1E90FF' onMouseout=this.bgColor='ccccff' >";
$Id_Localite= mysql_result($result , $Compteur ,"Id_Localite");
echo "<td onclick=setInfo(0,'$Id_Localite'); style='cursor: pointer' width=20%> <FONT color=black>$Id_Localite </font></td>";
$Localite = mysql_result($result , $Compteur ,"Localite");
echo "<td onclick=setInfo(0,'$Id_Localite'); style='cursor: pointer' width=40%> <FONT color=black>$Localite </font></td>";
$Code = mysql_result($result , $Compteur ,"Code");
echo "<td onclick=setInfo(0,'$Id_Localite'); style='cursor: pointer' width=25%> <FONT color=black>$Code </font></td>";
$Id_Pays = mysql_result($result , $Compteur ,"Id_Pays");
echo "<td onclick=setInfo(0,'$Id_Localite'); style='cursor: pointer' width=15%> <FONT color=black>$Id_Pays </font></td>";
echo "</tr>";
}
?>
</table>
Voilà en gros, je voudrais pouvoir récupérer les champs de ma table tlocalite par rapport à mon identifiant qui à été exporter dans le input. et afficher les champs dans les autres input.
Merci D'avance.
