<?php
/*
	power by JASON.ZHANG  DM建站  www.demososo.com
*/
 
 
	if($act=='insert'){

			if($abc1=="") $abc1= 'sub cate title...';

			if($abc2=="")  $abc2 = $catid;
			 
			 $catfid = $abc2;
	 
	  $pidname='csub'.$bshou;
			$ss = "insert into ".TABLE_CATE." (ppid,pid,pidname,pbh,name,list_can,last,level,lang,alias_jump,arr_can) values ('$catid','$catfid','$pidname','$user2510','$abc1','$arr_listcanV','y',1,'".LANG."','','$arr_maincateV')";
			 // echo $ss;exit;
			iquery($ss);
			//tongbu_pidname($table);//change id to pidname
			// alert("添加成功");
			//echo '<p style="padding:100px;text-align:center">添加成功！';
 

//---------------------
			
			 //alert("添加成功");
			//tongbu_pidname($table);//change id to pidname
			jump($jumpv);
	}
	
 
	
if($act=='add')	{

	$jump_insertupdatesub = $jumpv.'&file=add&act=insert';

?>	
 <h5> <a href="<?php echo $jumpv?>"><?php echo $maincatname?></a> - 添加子分类</h5>
<form  onsubmit="javascript:return checkhere(this)" action="<?php  echo $jump_insertupdatesub;?>" method="post" enctype="multipart/form-data">
<table class="formtab">

  <tr>
    <td width="18%" class="tr">子分类名称：</td>
    <td width="75%"><input name="name" type="text"   value="<?php echo $name?>" size="80">
 
  </td>
  </tr> 
    <tr>
    <td width="18%" class="tr">父级：</td>
    <td width="75%">
   <?php 
    $arr = getarr_cate2010($catid);
   // pre($arr);
   ?>
   <select name = "namefat">
   <option value="">请选择父级</option>
   <option value="<?php echo $catid?>"><?php echo $arr['catename']?></option>
   <?php 

   foreach ($arr['data'] as $k => $v) {
   	  ?>
 <option value="<?php echo $v['pidname']?>">   ├  <?php echo $v['name']?></option>
   	  <?php
   }?>
   </select>

    
  </td>
  </tr>
  <tr>
    <td></td>
    <td> <input class="mysubmit" type="submit" name="Submit" value="添加子分类"></td>
  </tr>
 </table>
  <?php echo $inputmust;?>
</form>
<?php
}
?>
<script>
function  checkhere(thisForm){
		if (thisForm.name.value==""){
		alert("请输入名称");
		thisForm.name.focus();
		return  false ; 
		
		}
		if (thisForm.namefat.value==""){
		alert("请选择父级");
		thisForm.namefat.focus();
		return  false ; 
		
		}

}
 </script>
 