J'ai une application qui permet de choisir des Codes d'articles dans une liste déroulante, cette liste est remplie a l'aide d'une base de donnée.
Voici le code pour remplir cette liste :
Code : Tout sélectionner
<form name="monform2" method="post" action="[php]<?php echo "init_fichier.php?util=" . $_GET['util'] ; ?>[/php]">
<select name="select1" title="[php]<?php echo $row_Recordset1b['Code_Article']; ?>[/php]">
[php]<?php
do {
?>[/php]
<option value="[php]<?php echo $row_Recordset1b['Code_Article']?>[/php]">[php]<?php echo $row_Recordset1b['Code_Article'] ," ", $row_Recordset1b['Libelle_Article']?>[/php]</option>
[php]<?php
} while ($row_Recordset1b = mysql_fetch_assoc($Recordset1b));
$rows = mysql_num_rows($Recordset1b);
if($rows > 0) {
mysql_data_seek($Recordset1b, 0);
$row_Recordset1b = mysql_fetch_assoc($Recordset1b);
}
?>[/php]
</select>
<!-- CREATION DU BOUTON -->
<input type="submit" method="POST" name="valid" value="VALIDER CODE" style="background:green" >
</form>Code : Tout sélectionner
<form name="monform1" method="post" action="[php]<?php echo "init_famille.php?util=" . $_GET['util'] ; ?>[/php]">
<select name="select2" title="[php]<?php echo $row_Recordset2['Code_Famille']; ?>[/php]" onChange="monform1.submit()">
[php]<?php
do {
?>[/php]
<option value="[php]<?php echo $row_Recordset2['Code_Famille']?>[/php]">[php]<?php echo $row_Recordset2['Libelle_Famille']?>[/php]</option>
[php]<?php
} while ($row_Recordset2 = mysql_fetch_assoc($Recordset2));
$rows = mysql_num_rows($Recordset2);
if($rows > 0) {
mysql_data_seek($Recordset2, 0);
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
}?>[/php]
</select>
</form>Code : Tout sélectionner
<table width="484" border="1">
<tr>
<td width="234">[php]<?php
echo "<strong>Famille : " . $row_RecordSet2b['Libelle_Famille'] . "</strong>";
?>[/php]</td>
<td width="234">[php]<?php
echo "<strong>Article : " . $row_Recordset1['Code_Article'] . "</strong>";
?>[/php]</td>
</tr>
</table>Merci d'avance pour l'aide apportée ainsi que pour "décortiquer" mon code!