可不可以把所有的记录都select出来,然后用DHTML控制他们的显示与否.
解决方案 »
- 最近整了个WINXP+IIS5.1+PHP+MYSQL,在PHPMYADMIN里遇到点问题,一直解决不了,望解……
- utf-8编码,有BOM头影响布局,去除还乱码!
- 国外的PHPer如此说?
- linux下查询mysql一个问题
- 为什么程序文件就不能requice("/src/db.php"),而资源可以用/photo/1.gif方式防问,
- 请问怎么才能浏览PHP的页面?
- SESSION的应用
- 急!在线等
- 怎么得到当前的时间啊?包括年月日,在线等待,解决即结帖!
- <input type="file" 数组问题
- 如何在php中让页面自动跳转到另一个页面。
- 请用正则把下面这个字符串str_replace成新的
具体的代码我没有,但是不难 我知道的
<?php
$query="select * from sys_school";
$mydb->query($query);
echo '<option value="">请选择学校</option>';
while ($mydb->next_record())
{
if ($school_code==$mydb->f(school_code))
{
echo '<option value="'.$mydb->f(school_code).'" selected>'.$mydb->f(school_name).'</option>';
}
else
{
echo '<option value="'.$mydb->f(school_code).'">'.$mydb->f(school_name).'</option>';
}
}
?>
</select>
<br>
<?php
if ($school_code!='')
{
echo '选择班级类型<select name="class_type" onchange="submit()"> ';
echo '<option value="">请选择班级类型</option>';
if ($class_type=="01")
{
echo '<option value="01" selected>初中</option>';
}
else
{
echo '<option value="01">初中</option>';
}
if ($class_type=="00")
{
echo '<option value="00" selected>高中</option>';
}
else
{
echo '<option value="00">高中</option>';
}
if ($class_type=="02")
{
echo '<option value="02" selected>小学</option>';
}
else
{
echo '<option value="02">小学</option>';
}
echo '</select>';
}
if ($school_code!='' && $class_type!='')
{
echo '选择年级<select name="grade" onchange="submit()"> ';
$query="select * from sch_gradeindex where school_code='$school_code' and num like '$class_type%'";
$mydb->query($query);
echo '<option value="">请选择年级</option>';
while ($mydb->next_record())
{
if ($grade==$mydb->f(num))
{
echo '<option value="'.$mydb->f(num).'" selected>'.$mydb->f(name).'</option>';
}
else
{
echo '<option value="'.$mydb->f(num).'">'.$mydb->f(name).'</option>';
} }
echo '</select>';
}
if ($school_code!='' && $class_type!='' && $grade!='')
{
echo ' 班级<select name="class" onchange="submit()">';
$query="select * from sch_classindex where school_code='$school_code' and class_num like '$grade%'";
$mydb->query($query);
echo '<option value="">请选择班级</option>';
while($mydb->next_record())
{
if ($class==$mydb->f(class_num))
{
echo '<option value="'.$mydb->f(class_num).'" selected>'.$mydb->f(class_name).'</option>';
}
else
{
echo '<option value="'.$mydb->f(class_num).'">'.$mydb->f(class_name).'</option>';
} }
echo '</select>';
}
?>
<input type="button" value="提交" onclick="
window.location='weisheng_input.php?school_code=<?php echo $school_code;?>&grade=<?php echo $grade;?>&class=<?php echo $class;?>&class_type=<?php echo $class_type;?>&action=setup';
" <?php lock_right(75);?>>
set conn=OpenDB()
dim first,second,third%>
<script language = "JavaScript">
var arrSel=["FirClaCode","SecClaCode","ThrClaCode"]
var arrData=new Array()
</script>
<%set rsf=server.createobject("adodb.recordset")
rsf.open "select * from FirClass order by FirClaCode",conn,1,1
i=0
response.write "PP"
if rsf.eof and rsf.bof then
response.write "请先添加栏目"
response.end
else
do while not rsf.eof
first=rsf("FirClaCode")
set rss=server.createobject("adodb.recordset")
rss.open "select * from SecClass where FirClaCode="&first ,conn,1,1
if rss.eof and rss.bof then
response.write "请先添加栏目"
response.end
else
do while not rss.eof
second=rss("SecClaCode")
response.write second&"s"
set rst=server.createobject("adodb.recordset")
rst.open "select * from ThrClass where FirClaCode='"&first&"' and SecClaCode='"&second&"'" ,conn,1,1
do while not rst.eof
third=rst("ThrClaCode")
response.write third&"t"
%>
<script language = "JavaScript">
arrData[arrData.length] = new Array("<%= trim(rsf("FirClaName"))%>","<%= rss("SecClaName")%>","<%= rst("ThrClaName")%>");
</script>
<% rst.movenext
loop
rst.close
rss.movenext
loop
end if
rss.close
i=i+1
'response.write first[i]
rsf.movenext
loop
end if
rsf.close
%><form name="form1">
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td height="30" align="center" width="50%">产品分类:</td>
<td width="50%">
<select name=FirClaCode onchange="changlacation(1)"></select>
<select name=SecClaCode onchange="changlacation(2)"></select>
<select name=ThrClaCode></select>
</td>
</tr>
</table>
</form><script language = "JavaScript">
function changlacation(num)
{
var find=false
var i,j,arrTemp=[];
for(i=0;i<num;i++)arrTemp[i]=eval("document.form1."+arrSel[i]).value
alert(eval("document.form1."+arrSel[i]).value)
if(num<arrSel.length)
with(eval("document.form1."+arrSel[num]))
{
length=0
for(i=0;i<arrData.length;i++)
{
for(j=0;j<num;j++)if(arrTemp[j]!=arrData[i][j])break;
if(j!=num)continue;
if(length==0||options[length-1].text!=arrData[i][num])
{
for(m=0;m<options.length;m++)if(options[m].text==arrData[i][num])find=true
if(!find)options[options.length]=new Option(arrData[i][num],arrData[i][num])
}
}
changlacation((num+1))
}
}
changlacation(0)
</script>刚刚早上完成的,数据库表有三张,FirClass,SecClass,ThrClass
数据结构:
FirClass
id(自增), FirClaCode(文本),FirClaName(文本)SecClass
id(自增), SecClaCode(文本),FirClaCode(文本),SecClaName(文本)ThrClass
id(自增), ThrClaCode(文本),FirClaCode(文本),SecClaCode(文本),ThrClaName(文本),