欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

层叠菜单的动态生成

程序员文章站 2022-11-01 10:11:56
<html><body bgcolor=ffffff>
<form action="<?php echo $path_info?>" method=post>
<?php
  if (isset($hierarchy)){
      //$hierarchy[] = $selection;
      if (isset($hierarchy)){
        while(list($level, $sel) = each($hierarchy)){
          echo "<input type=hidden name=hierarchy[$level] value=$sel>";
          echo $level, ': ', $sel, "<br>n";
          $nextlevel = (int) $level + 1;
        }
    }
  }
  else{
      $nextlevel = 0;
  }
  echo "<select name=hierarchy[", $nextlevel, "]>n";
  for ($i = 1; $i <= 10; $i++){
    echo "<option value=$i>$i</option>n";
  }
  echo "</select>n";
?>
<input type=submit>
</form>
</body></html>