Mailinglisten-Archive |
>
>
> $option_block="<select name="SEL_FELD" >";
>
> > while ($row = mysql_fetch_array($sql_result)) {
> > if($row["auswahl_id"] == $pleaseSelectItem)
>
> > $option_block .= "<option value="
> .$row["auswahl_id"]."
> > selected >".$row["auswahl"]."</option>";
> > }else{
> > $option_block .= "<option value="
> > .$row["auswahl_id"].">".$row["auswahl"] ."</option>";
> > }
> > }
>
>
> $option_block.="</select>";
>
> versuchs doch mal damit.
>
> gruß
> rainer
habe den code jetzt umgestellt:
$sql = "SELECT auswahl_id,auswahl_01 FROM auswahl";
$sql .= " ORDER BY auswahl_id";
$sql .= ";";
$pleaseSelectItem = 2;
// Die SQL-Anweisung ausführen
$sql_result = mysql_db_query( $DB_DATABASE, $sql, $dbh ) or
mysql_die();
// mit einer Schleife die select-box aus der Datenbank füllen
$option_block ="<select name=\"SEL_FELD\">";
while ($row = mysql_fetch_array($sql_result)) {
if($row["auswahl_id"] == $pleaseSelectItem) {
$option_block .= "<option value=" .$row["auswahl_id"]."
selected >".$row["auswahl_01"]."</option>";
}else{
$option_block .= "<option value="
.$row["auswahl_id"].">".$row["auswahl_01"] ."</option>";
}
}
$option_block.="</select>";
--------------------------------
und weiter in html:
--------------------------------
<form action="top1.php3" method="post" target="">";
<? echo "$option_block"; ?>
</td>
<td height="24" width="76" valign="bottom"><INPUT TYPE="SUBMIT"
name="going" value="go"></td>
</form>
nach wie vor wird immer der zweite Eintrag 'selected'.
Keine andere Auswahl bleibt im Feld stehen.
Wer weiß Hilfe ... Danke erstmal an Rainer und die anderen
Frank
--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net
--
GMX Tipp:
Machen Sie Ihr Hobby zu Geld bei unserem Partner 1&1!
http://profiseller.de/info/index.php3?ac=OM.PS.PS003K00596T0409a
php::bar PHP Wiki - Listenarchive