var subcat2 = new Array();
<?
$i=0;
$sql="select * from cat_small ";//查询所有小类
$result=mysql_query($sql);
while($rs=mysql_fetch_array($result))
{
 echo "subcat2[".$i++."] = new Array('".$rs["id"]."','".$rs["cat_bigId"]."','".$rs["cat_name"]."');\n";
}
?>

function changeselect1(locationid)
{

document.leave_word.s2.length = 0;
document.leave_word.s2.options[0] = new Option('请选择','');
 //alert(subcat2[1].toString());
 //alert(locationid.length.toString());
for (i=0; i<subcat2.length; i++)
{
 if (subcat2[i][1] == locationid)
{
 document.leave_word.s2.options[document.leave_word.s2.length] = new Option(subcat2[i][2], subcat2[i][0]);}
}
}

 

</script>
<form method="post" action="mian.php" enctype="multipart/form-data" name="leave_word" onSubmit="return checkname()">
<?php
  if(isset($_SESSION['name'])){

?>


<table align="center" style="margin-top:50px;">
 <tr>
  <td style="font-size:12px;">用户<?=htmlspecialchars($_SESSION['name'])?></td>
  <td height="23"> <a href="regok.php?action=out">注销</a></td>
  </tr>

  <tr>
  <td style="font-size:12px;">上传文件:</td>
  <td height="23">

  <select name="s1" width="20" onChange="changeselect1(this.value)">
    <option  selected>请选择</option>
  <?php
   $sql = "select * from cat_big order by id ";
   $result = mysql_query($sql);
   $row = mysql_num_rows($result);

   while($rs = mysql_fetch_array($result)) {
      echo "<option value=\"".$rs['id']."\" >";
      echo $rs['cat_name'];
      echo "</option>";
   }
?>

 </select>
   <select name="s2">
    <option selected>请选择</option>
   </select>
   <input type="hidden" name="MAX_FILE_SIZE" value="20000">
  <input type="file" name="filename" style="height:20px; line-height:16px; width:300px;"> </td>
  </tr>
  <tr>
  <td style="font-size:12px;">描述:</td>
  <td height="23"><textarea name="textname" style="height:100px; width:440px;"></textarea></td>
  </tr>
  <tr>
  <td></td><td height="23" align="center">
  <input type="image" src="images/input01.gif" />
  <img src="images/input02.gif" style="cursor:hand" onClick="document.all.leave_word.reset()" /></td>
 </tr>

</table>

posted on 2010-04-14 12:02  FreeSpider  阅读(622)  评论(0编辑  收藏  举报