700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > php日期下拉列表联动 究了一下连动下拉菜单 共享一下 希望_php

php日期下拉列表联动 究了一下连动下拉菜单 共享一下 希望_php

时间:2022-07-26 02:53:28

相关推荐

php日期下拉列表联动 究了一下连动下拉菜单 共享一下 希望_php

php代码:--------------------------------------------------------------------------------

List

/45195.html究了一下连动下拉菜单,共享一下,希望_php

if( !( $link = mysql_connect() ) ){

fatal("Could not connect to local MySQL server.");

}

if( !mysql_select_db( "loaction", $link ) )

{

mysql_close( $link );

fatal("Could not select databaseParserSample.");

}

$sql="select * from district order by locationid asc";

$query=mysql_query($sql,$link);

?>

var onecount;

onecount = 0;

subcat = new Array();

$count=0;

while($rs=mysql_fetch_array($query)){

?>

subcat[=$count;?>] = new Array("=$rs['districtname'];?>","=$rs['locationid'];?>","=$rs['districtid'];?>","=$rs['areacode']?>","=$rs['zipcode']?>");

$count++;

}

?>

onecount==$count?>;

function GetCode(CityId){

var CityId=CityId;

var i;

for(i=0;i < onecount; i++){

if(subcat[i][2] == CityId){

document.FormData.AreaCode.value = subcat[i][3];

document.FormData.ZipCode.value = subcat[i][4];

}

}

}

function ClearCode(){

document.FormData.AreaCode.value = '';

document.FormData.ZipCode.value = '';

}

function getCity(locationid)

{

document.FormData.City.length = 0;

var locationid=locationid;

var i;

document.FormData.City.options[0] = new Option('==所选城市的地区==','');

for (i=0;i < onecount; i++)

{

if (subcat[i][1] == locationid)

{

document.FormData.City.options[document.FormData.City.length] = new Option(subcat[i][0], subcat[i][2]);

}

}

}

分类:

请选择你所在的省份

$sql1= "select * from loaction";

$query=mysql_query($sql1,$link);

$a=mysql_num_rows($query);

while($rs1=mysql_fetch_array($query)){

?>

=$rs1['loactionname'];?>

}?>

==所有地区==

if(!empty($_POST['City'])){

echo $_POST['City'];

}

?>

表结构:

#

# 表的结构 `district`

#

# 创建时间: 年 08 月 02 日 11:21

# 最后更新时间: 年 08 月 02 日 11:21

#

CREATE TABLE `district` (

`locationid` int(10) NOT NULL default '0',

`districtid` int(10) NOT NULL auto_increment,

`areacode` varchar(4) NOT NULL default '',

`zipcode` varchar(6) NOT NULL default '',

`districtname` varchar(50) NOT NULL default '',

KEY `districtid` (`districtid`)

) TYPE=MyISAM AUTO_INCREMENT=7 ;

#

# 表`district`中数据locationid――省id;districtid――市id;districtname――市名称; areacode ――市区号;zipcode――市邮政编码

#

# --------------------------------------------------------

#

# 表的结构 `loaction`

#

# 创建时间: 年 08 月 02 日 09:28

# 最后更新时间: 年 08 月 02 日 10:36

#

CREATE TABLE `loaction` (

`loactionid` int(10) NOT NULL auto_increment,

`loactionname` varchar(50) NOT NULL default '',

KEY `loactionid` (`loactionid`)

) TYPE=MyISAM AUTO_INCREMENT=4 ;

#

# 表`loaction`中数据,loactionid――省id;loactionname――省名称

#

#表

欢迎大家阅读《究了一下连动下拉菜单,共享一下,希望_php》,跪求各位点评,若觉得好的话请收藏本文,by 搞代码

微信 赏一包辣条吧~

支付宝 赏一听可乐吧~

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。