php组合查询,php结合js实现多条件组合查询

本文实例为大家分享了php结合js实现多条件组合查询的具体代码,供大家参考,具体内容如下

一、效果图

b581dc4fa1ec901a810553e8e50f9ae1.png

二、前端代码

Jquery分类

.templinkactive {

padding:5px;

text-decoration:none;

color:red;

}

.templink {

cursor:pointer;

padding:5px;

text-decoration:none;

}

table{border:1px solid #ccc;}

table tr{ height:35px;}

$(function () {

//品牌

var alink01 = $("#linktype01").find("span");

alink01.click(function () {

alink01.each(function () {

$(this).removeClass("templinkactive").addClass("templink");

});

$(this).removeClass("templink").addClass("templinkactive");

$("#Brand").val($(this).attr("tag"));

SetPara();

});

//价格

var alink02 = $("#linktype02").find("span");

alink02.click(function () {

alink02.each(function () {

$(this).removeClass("templinkactive").addClass("templink");

});

$(this).removeClass("templink").addClass("templinkactive");

$("#Price").val($(this).attr("tag"));

SetPara();

})

//尺寸

var alink03 = $("#linktype03").find("span");

alink03.click(function () {

alink03.each(function () {

$(this).removeClass("templinkactive").addClass("templink");

});

$(this).removeClass("templink").addClass("templinkactive");

$("#Size").val($(this).attr("tag"));

SetPara();

});

});

function SetPara() {

var Brand = $("#Brand").val();

var Price = $("#Price").val();

var Size = $("#Size").val();

alert("1.php?Brand=" + Brand + "&Price=" + Price + "&Size=" + Size);

// var keywords = $("#search").val();

// var skip_url = "http://" + window.location.hostname + window.location.pathname;

// var url = skip_url + "?s=/admin/goods/goods_list/Brand/"+Brand+"/Price/"+Price+"/Size/"+Size;

// window.location.href = url;

// alert(url);

};

/*//TP框架-start

$(function(){

var Brand = $("#Brand").val();

var Price = $("#Price").val();

var Size = $("#Size").val();

// alert(tag);

if(Brand != ''){

$("#linktype01").find("span").removeClass("templinkactive").addClass("templink")

$('span[tag="'+Brand+'"]').css('color','red');

}

if(Price != ''){

$("#linktype02").find("span").removeClass("templinkactive").addClass("templink")

$('span[tag="'+Price+'"]').css('color','red');

}

if(Size != ''){

$("#linktype03").find("span").removeClass("templinkactive").addClass("templink")

$('span[tag="'+Size+'"]').css('color','red');

}

});

//TP框架-end*/

笔记本品牌

不限

联想(Lenovo)

宏?(Acer)

华硕(ASUS)

戴尔(DELL)

苹果(Apple)

三星 (SAMSUNG)

价格范围

不限

1000-2999

3000-3499

4000-4499

5000-5999

6000-6999

7000及以上

尺寸范围

不限

8.9英寸及以下

11英寸

12英寸

13英寸

14英寸

15英寸及以上

三、服务端代码

goodsController.class.php

public function goods_list(){

$Brand= I('Brand');

$Price= I('Price');

$Size= I('Size');

$this->assign('Brand',$Brand);

$this->assign('Price',$Price);

$this->assign('Size',$Size);

$this->display();

}

?>

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持龙方网络。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值