Hier der Code:
killersushi: Sehe ich das Richtig dass der Code von dir einen bestimmten Eintrag im Select-Objekt auswält?
[php]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="admin.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function focus_ukat() {
document.formular.ukat.focus();
//document.formular.ukat.select();
}
function reload_kat() {
document.formular.kat.refresh();
//document.formular.ukat.select();
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" onLoad="focus_ukat()">
<span class="ueberschrift">Unterkategorie hinzufügen</span> <br>
<?php include("db_connect.php") ?>
<form name="formular" method="post" action="add_ukat.php">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="125" height="20" class="standard">
<div align="right">Hauptkategorie: </div></td>
<td width="300" height="20">
<select name="hkat" id="hkat" onChange="<?php $change_kat = "1"?>">
<?php
if ($change = 1){
$sql_string = "SELECT hk_n FROM xos_hkat_db ORDER BY hk_n";
$ergebnis = mysql_query($sql_string) or die(mysql_error());
while ($zeile = mysql_fetch_row($ergebnis))
{
echo "<option>" . $zeile[0] . "</option>\n";
}
}
?>
</select>
</td>
</tr>
<tr>
<td width="125" height="20" class="standard">
<div align="right">Kategorie: </div></td>
<td width="300" height="20">
<select name="kat">
<?php
$sql_string = "SELECT k_n FROM xos_kat_db WHERE hk_id='$hkat' ORDER BY k_n";
$ergebnis = mysql_query($sql_string) or die(mysql_error());
while ($zeile = mysql_fetch_row($ergebnis))
{
echo "<option>" . $zeile[0] . "</option>\n";
}
?>
</select>
</td>
</tr>
<tr>
<td width="125" height="20" class="standard">
<div align="right">Unterkategoriename: </div></td>
<td width="300" height="20">
<input name="ukat" type="text" id="ukat" size="50"></td>
</tr>
<tr>
<td width="125"><div align="right"></div></td>
<td width="300"> <br> <input type="submit" name="add" style="background-color:#efefef; border:none; font-weight:bold; color:000000;" value="Hinzufügen">
<input name="reset" type="reset" id="reset" style="background-color:#efefef; border:none; font-weight:bold; color:000000;" value="Löschen" onclick="focus_ukat()">
</td>
</tr>
</table>
<br>
<br>
<br>
</form>
</body>
</html>[/php]