Problème avec mon menu défilant

j'essaye de laissé séléctionné la variable précédement selectionné après un rafraichissement, mais au lieu de cela c'est toujours la même valeur (la dernière) qui reste selectionnée.

voici mon code:

<? include("../include/headerlog2.php");

$Aff_IDrec=$_GET['$Aff_IDrec'];

?>
<script LANGUAGE="JavaScript">
<!--
function Submit() {
document.Aff_IDrec.action = "technicien.php";
return true;
}

// -->
</SCRIPT>

</td>
<td class='boxright'></td></tr><tr>
<td class='boxbottomleft'></td>
<td class='boxbottom' colspan='3'></td>
<td class='boxbottomright'></td>
</tr>
</table>
</td>
</tr>
</table>
<table summary='box_center' cellspacing='0' cellpadding='0' width='100%' border='0'>
<tr>
<td width="12" height="51" class='boxtopleft'> <!- Specially for IE -></td>
<td class='boxtitle'></td>
<td width="12" class='boxtopright'> <!- Specially for IE -></td>
</tr>
<tr>
<td class='boxleft'></td>
<td align="right"> </td>
<td class='boxright'></td>
</tr>
<tr>
<td class='boxleft'></td>
<td align="right"><table width="100%" border="1">
<tr>
<td align="center" bgcolor="#FFFF99"><strong>Choix de l'afficheur</strong> </td>
</tr>
<tr>
<td align="center">
<form action="technicien.php" method="get" name="Aff_IDrec" >
<?

echo '<select size=1 name="Aff_ID" onChange="submit();">'."\n";
$DB->query ("SELECT Aff_ID FROM Afficheurs");
$i=0;
while ($DB->fetch_object())
{
$Aff_ID[$i]=$DB->o(Aff_ID);

echo '<option value="'.$Aff_ID[$i].'" if($Aff_IDrec =="'.$Aff_ID[$i].'"){ echo " selected"; }>'.$Aff_ID[$i++];
echo '</option>'."\n";
}
echo '</select>';
?>
</form>
Configuration: Windows XP
Firefox 1.5.0.11

1 réponse

  1. Contributeur
    Salut,

    Comme je n'ai pas le BDD je n'est pas trop chercher à comprendre ce que tu essais de faire, en revanche tu a une ligne très bizarre :

    echo '<option value="'.$Aff_ID[$i].'" if($Aff_IDrec =="'.$Aff_ID[$i].'"){ echo " selected"; }>'.$Aff_ID[$i++];
    
    ___
    echo '<option value="'.$Aff_ID[$i];
    
    if($Aff_IDrec ==$Aff_ID[$i])
    	{ 
    		echo 'selected">'.$Aff_ID[$i++];
    	}

    0