日期:2014-05-16 浏览次数:20555 次
<script language="javascript">
var subcat2 = new Array();
<?php
require('config.php');
$i=0;
$sql="select * from p_cclass ";//查询所有小类
$result=MySQL_query($sql);
while($rs=mysql_fetch_array($result))
{
echo "subcat2[".$i++."] = new Array('".$rs["cc_id"]."','".$rs["cid_ccid"]."','".$rs["classname"]."');\n";
}
?>
function changeselect1(locationid)
{
document.myform.cc_id.length = 0;
document.myform.cc_id.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.myform.cc_id.options[document.myform.cc_id.length] = new Option(subcat2[i][2], subcat2[i][0]);}
document.myform.cc_id.options[0] = new Option('==请选择二级分类==','');
}
}
</script>
<form action="pro_edit.php" method="post" name="myform" id="myform" >
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F1F5F8">
<tr>
<td width="697" height="51"><table width="100%" height="175" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="31" colspan="2" align="center" bgcolor="#D6E7F7">修改产品</td>
</tr>
<tr>
<td width="65" height="26"> 产品类型:</td>
<td width="632" height="26"><select name="c_id" id="c_id" onChange="changeselect1(this.value)" style="width:100;border:1 solid #9a9999; font-size:9pt; background-color:#ffffff">
<?php
require("config.php"); //包含文件
$p_id=$_GET["p_id"];
$sqlp = "select * from product where p_id='$p_id'";
$rsp=mysql_query($sqlp);
$rscountp=mysql_fetch_array($rsp);
$c_id=$rscountp["p_cid"];
$sql="select * from p_class where c_id='$c_id'";//查询表
$rs=mysql_query($sql);
$rscount=mysql_fetch_array($rs)
?>
<option value="<?=$rscount["c_id"]?>"><?=$rscount["classname"]?></option>
<?php
$sqln="select * from p_class where c_id!='$c_id'";//查询表
$rsn=mysql_query($sqln);
while($rscountn=mysql_fetch_array($rsn)){
?>
<option value="<?=$rscountn["c_id"]?>"><?=$rscountn["classname"]?></option>
<?php
}
?>
</select>
</select>
<select name="cc_id" id="cc_id" style="width:100;border:1 solid #9a9999; font-size:9pt; background-color:#ffffff">
<?php
$p_id=$_GET["p_id"];
$sqla = "select * from product where p_id='$p_id'";
$rsa=mysql_query($sqla);
$rscounta=mysql_fetch_array($rsa);
$c_id=$rscounta["p_cid"];
$sqlb = "select * from p_class where c_id='$c_id'";
$rsb=mysql_query($sqlb);
$rscountb=mysql_fetch_array($rsb);
$cid_ccid=$rscountb["c_id"];
?>