php实现多级分类筛选程序代码
Jun 02, 2016 am 09:13 AM
foreach
现在这种多选择功能在很多网站都有,如现在很多电商网站都有N个条件选择了,下面小编为各位介绍一个简单的多级分类筛选实现方法。
主要注意这边有一个 $$这是变量的变量。 以后估计会常用这个做开发。
<?php $conditions = array('price','color','metal');//要进行筛选的字段放在这里 $price = $color = $metal='';//先给需要筛选的字段赋空值,这些值将输出到页面的hidden fileds 中 //以下循环给已经进行的筛选赋值,以便能够在下一次筛选中保留 foreach($conditions as $value){ if(isset($_GET[$value])){ $$value = $_GET[$value]; } } //以下是演示输出$_GET数据 echo '<pre class="brush:php;toolbar:false">'; print_r($_GET); echo '
Copy after login
颜色:红色 蓝色
材质:纯金 纯银
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article
Repo: How To Revive Teammates
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD

Hot tools Tags

Hot Article
Repo: How To Revive Teammates
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

What is the difference between using foreach and iterator to delete elements when traversing Java ArrayList?

How to determine the number of foreach loop in php

PHP returns an array with key values flipped

PHP returns the current element in an array

How to iterate through the properties of an object using the forEach function?

What is the difference between foreach and for loop

How to get the index value of the current element in php foreach loop
