Difference between #1 and #2 of
How to filter data using a dropdown list?

Revision #2 has been created by rainyjune on Jun 16, 2010, 2:55:12 AM with the memo:

add Chinese version
« previous (#1) next (#3) »


Title unchanged

How to filter data using a dropdown list?

Category unchanged


Yii version unchanged

Tags unchanged

Content changed

We first create a form which uses GET as the submission method. We then use [CHtml::dropDownList] to create the dropdown list. We specify two HTML options for the dropdown list:

* empty: this displays an extra dropdown list item at the beginning because this item is not provided by the `$categories` array.
* submit: this makes the dropdown list to be able to submit the form. If you change the current selection, the form enclosing the dropdown list will be submitted to the current page (because the submit value is empty).

Once the form is submitted, we will obtain a `cat` GET variable which contains the current category selection. We use this value to filter the extensions and display the corresponding results.

### Links
[Chinese version](http://dreamneverfall.cn/node/110)
7 0
Viewed: 31 143 times
Version: 1.1
Category: Tutorials
Written by: qiang
Last updated by: Yang He
Created on: Feb 16, 2009
Last updated: 5 years ago
Update Article


View all history