您好,欢迎访问一九零五行业门户网

代码示例展现PHP二级联动菜单的实现_PHP教程

对于初学者来说,
php二级联动菜单代码示例:
 script language = javascript>    var onecount;    onecount=0;    subcat = new array();     ?php    mysql_connect(localhost,charles,
charles);    mysql_select_db( _crm );    $sql = select * from site;    $result = mysql_query( $sql );    $count = 0;    while($res = mysql_fetch_row($result)){    ?>    subcat[ ?php echo $count ?>] = new array
( ?php echo $res[0]?>, ?php echo
 $res[2]?>, ?php echo $res[1]?>);     ?php    $count++;    }    echo onecount=$count;;    ?>    //联动函数    function changelocation(locationid)    {    document.myform.ctype.length = 0;    var locationidlocationid=locationid;    var i;    for (i=0;i   onecount; i++)    {    if (subcat[i][2] == locationid)    {    //var newnewoption1=new option(subcat[i]
[1], subcat[i][0]);    //document.all.ctype.add(newoption1);    document.myform.ctype.options[document.
myform.ctype.length] = new option(subcat
[i][1], subcat[i][0]);    }    }    }     /script>     form method=post name=myform 
action=ru_query.php>     select name=type onchange=changelocation(
document.myform.type.options[document.myfo
rm.type.selectedindex].value) size=1>     option selected value=>main /option>     ?php    $sql = select * from entreprise;    $result = mysql_query( $sql );    while($res = mysql_fetch_row($result)){    ?>     option value=>  ?php echo $res[1]; ?> /option>     ?php } ?>     /select>     select name=ctype>     option selected value=>sub /option>     /select>     input type=submit name=submit value=search>     /form>  以上代码就是php二级联动菜单的具体实现方法。
http://www.bkjia.com/phpjc/445993.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/445993.htmltecharticle对于初学者来说, php二级联动菜单代码示例: script language = javascript varonecount; onecount = 0 ; subcat = new array(); ?php mysql_connect(localhost,charles, c...
其它类似信息

推荐信息