So in etwa, ohne Garantie
PHP-Code:
<!--SELECT dynamisch belegen-->
<script type="text/javascript">
var valuesSec = new Array(
new Array("--"),
<?php
$outc = 1;
$uhol = mysql_query("SELECT * FROM rubriken WHERE rubrik_parent_id = '0' ORDER BY rubrik_bezeichnung");
while ($anzeige = mysql_fetch_array($uhol)) {
?>
new Array(
<?php
$inc = 1;
$subhol = mysql_query("SELECT * FROM rubriken WHERE rubrik_parent_id = '".$anzeige['rubrik_id']."' ORDER BY rubrik_bezeichnung");
while ($subanzeige = mysql_fetch_array($subhol)) {
?>
new Array("<?php echo $subanzeige['rubrik_bezeichnung'];?>", "<?php echo $subanzeige['rubrik_id'];?>")<?php if($inc<mysql_num_rows($subhol)) echo ',';?>
<?php
$inc++;
}
?>
) <?php if($outc<mysql_num_rows($uhol)) echo ',';?>
<?php
$outc++;
}?>
);
function setSecondary() {
nPos = document.myForm.firstSel.selectedIndex;
nOldLength = document.myForm.secondSel.length;
nNewLength = valuesSec[nPos].length;
for(i=0; i<nNewLength; i++) {
document.myForm.secondSel.options[i] = new Option(valuesSec[nPos][i][1]);
document.myForm.secondSel.options[i].value = valuesSec[nPos][i][0];
if (i==0) document.myForm.secondSel.selectedIndex = 0;
}
for(i=nOldLength; i>nNewLength; ) document.myForm.secondSel.options[--i] = null;
}
</script>