首页 > 代码库 > 三联动11
三联动11
数据库crm_province(AUTOid,TypeName)、crm_city(ID,province_id,city_title)、crm_area(ID,province_id,city_id,area_title)注:MYSQL数据库连接正确(即:include_once("../inc/conn.php")文件和路径均完全正确)<?php include_once("../inc/conn.php");?><script language="JavaScript"><!--var subval2 = new Array();<?php$sqlClass2=mysql_query("select * from crm_city order by ID asc");$rsClass2=mysql_fetch_array($sqlClass2);$count2=0;if($rsClass2!=false){do{?>subval2[<?php echo $count2;?>] = new Array(‘<?php echo $rsClass2[province_id];?>‘,‘<?php echo $rsClass2[ID];?>‘,‘<?php echo $rsClass2[city_title];?>‘);<?php$count2=$count2+1;}while($rsClass2=mysql_fetch_array($sqlClass2));}?>onecount2=<?php echo $count2;?>;var subval3 = new Array();<?php$sqlClass3=mysql_query("select * from crm_area order by ID asc");$rsClass3=mysql_fetch_array($sqlClass3);$count3=0;if($rsClass3!=false){do{?>subval3[<?php echo $count3;?>] = new Array(‘<?php echo $rsClass3[city_id];?>‘,‘<?php echo $rsClass3[ID];?>‘,‘<?php echo $rsClass3[area_title];?>‘);<?php$count3=$count3+1;}while($rsClass3=mysql_fetch_array($sqlClass3));}?>onecount3=<?php echo $count3;?>; function changeselect1(locationid1){ document.form1.s2.length = 0; document.form1.s2.options[0]=new Option(‘==所属市区==‘,‘‘); document.form1.s3.length = 0; document.form1.s3.options[0]=new Option(‘==所属区县==‘,‘‘); for (i=0;i<onecount2;i++) { if (subval2[i][0]==locationid1) {document.form1.s2.options[document.form1.s2.length]=new Option(subval2[i][2],subval2[i][1]);} }}function changeselect2(locationid2){ document.form1.s3.length = 0; document.form1.s3.options[0] = new Option(‘==所属区县==‘,‘‘); for (i=0;i<onecount3;i++) { if (subval3[i][0]==locationid2) {document.form1.s3.options[document.form1.s3.length]=new Option(subval3[i][2],subval3[i][1]);} }}//--></script><table width="100%" border="0" cellspacing="0" cellpadding="0"><form name="form1" method="POST" action="a.php"> <tr> <td width="150"><select name="s1" onChange="changeselect1(this.value)"><option>==所属省份==</option><?php$sqlClass1=mysql_query("select * from crm_province order by autoID asc");$rsClass1=mysql_fetch_array($sqlClass1);$count1=0;if($rsClass1!=false){do{?><option value="http://www.mamicode.com/<?php echo $rsClass1[autoID];?>"><?php echo $rsClass1[TypeName];?></option><?php$count1++;}while($rsClass1=mysql_fetch_array($sqlClass1));}?></select><font color="#FF0000">*</font></td> <td width="150"><select name="s2" onChange="changeselect2(this.value)"> <option>==所属市区==</option></select><font color="#FF0000">*</font></td> <td><select name="s3"> <option>==所属区县==</option></select><font color="#FF0000">*</font></td> </tr> </form></table>
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。