Wert übergeben mittels dropdown menu

sadi

Mitglied
Hallo auch,
ich würde gerne eine dropdown menu realisieren, welches bei Auswahl eines Menupunktes sofort weiterspringt und dabei den Wert eine PHP variable an die nächste Seite übergibt. Aus irgendeinen Grund möchte das aber nicht funktionieren.
Das Skript lautet wie folgt:

<?php include("../include/includer.inc.php");

mysql_select_db("wwsys");
$katanfr = @mysql_query("SELECT * FROM tbl_kategorie");

echo ("<body bgcolor='#B6C9D8'>
<form name='auswahlform' method='post'>
<select name='produktgruppe' size='1' onchange='parent.main.location.href =
document.auswahlform.produktgruppe.options[document.auswahlform.produktgruppe.selectedIndex].value;'>");

while ($kat = mysql_fetch_array($katanfr)) {
$katname = htmlspecialchars($kat["Beschreibung"]);
$kati = $kat["id"];
$tblname = $kat["tbl_name"];
echo ("<option value='../script/showkat.php?KatID=$kati&tabelle=$tblname'>
<font size='2' face='Verdana' color='#000000'> $katname </font> <br>
</a></option>
");
} // while
echo ("</select>
</form>
</body>
");

?>

Vielleicht sieht jemand einen Fehler.

Cu

Sascha
 
PHP:
<?php include("../include/includer.inc.php");

mysql_select_db("wwsys");
$katanfr = @mysql_query("SELECT * FROM tbl_kategorie");

echo ("<body bgcolor='#B6C9D8'>
<form name='auswahlform' method='post'>
<select name='produktgruppe' size='1' onchange='parent.main.location.href =
document.auswahlform.produktgruppe.options[document.auswahlform.produktgruppe.selectedIndex].value;'>");

while ($kat = mysql_fetch_array($katanfr)) {
$katname = htmlspecialchars($kat["Beschreibung"]);
$kati = $kat["id"];
$tblname = $kat["tbl_name"];
echo ("<option value='../script/showkat.php?KatID=$kati&tabelle=$tblname'>
<font size='2' face='Verdana' color='#000000'> $katname </font> <br>
</a></option>
");
} // while
echo ("</select>
</form>
</body>
");

?>

Per <option value=wert>Beschreibung</option>
übergibst du den Wert,
Allerdings musst du eine Optionsliste mit <select name=name_womit_du_den_wert_abrufen_kannst size=1> und nach den <options> </select>.
 
Zurück