How to implement classification search on a PHP search page

Source: Internet
Author: User
How does a PHP search page implement classified search? This post was last edited by u010572351 from 2013-06-22:09:22. for a mall or a Movie Station, I need to perform various searches, such as searching by type, they will be retrieved separately by generation, by generation, and by Origin. However, if I select a type, then how can I implement the classification search on the PHP search page?
This post was last edited by u010572351 at 10:09:22. I need to search for a mall or a Movie station, such

Separate, search by type, will
Separately, retrieved by generation, meeting
Search by Origin separately.

However, if I select a type, then I select the origin, then the age, or the combination of the three operations, it is quite complicated and I don't know how to deal with it,

Please kindly advise, how to retain the filter parameters selected by the previous user?

Then the origin, age, and type links cannot be written, because they cannot be written separately,
I now have the time parameter, and the type only has its own type parameter. The Origin parameter is the origin parameter, for example:
Mainland China
Action
2011

There is only one condition at a time, and it cannot coexist or implement multi-condition filtering.
What should I do with this? Share:
------ Solution --------------------
$ Area = $ _ GET ['region']; // you need to process the get value yourself.
$ Type = $ _ GET ['type'];
$ Year = $ _ GET ['Year'];
$ SQL = "select * from shop where 1 ";
$ SQL. = isset ($ area )? "And area = '$ region '":'';
$ SQL. = isset ($ type )? "And type = '$ type '":'';
$ SQL. = isset ($ year )? "And area = '$ year '":'';
$ Result = mysql_query ($ SQL );
While ......
I hope my answers will help you.

------ Solution --------------------
You do this.
Echo join ('-', $ _ GET ),'
';
$ Dict = array (
'Area '=> array ('mainland', 'Hong Kong and Taiwan '),
'Type' => array ('action', 'love '),
'Year' => array ('20140901', '20160901 '),
);
Foreach ($ dict as $ key => $ item ){
$ Param = $ _ GET;
Foreach ($ item as $ v ){
$ Param [$ key] = $ v;
$ T = http_build_query ($ param );
Echo "$ v ";
}
Echo'
';
}

------ Solution --------------------
You can also use session processing
 Session_start ();
If (! Isset ($ _ SESSION ['search'])
$ _ SESSION ['search'] = array ();
$ _ SESSION ['search'] = array_merge ($ _ SESSION ['search'], $ _ GET );
Echo join ('-', $ _ SESSION ['search']),'
';
?>
Mainland China
Action
2011

------ Solution --------------------
Yes, you are using it to mark the jump, without js

Echo join ('-', $ _ GET ),'
';
Is to allow you to intuitively observe the changes in the click
------ Solution --------------------
Is your program file saved as search1.php?
------ Solution --------------------
Give a more relaxed condition (whatever file name is saved, of course, the suffix is php)
Session_start ();
If (! Isset ($ _ SESSION ['search'])
------ Solution --------------------
! $ _ GET)
$ _ SESSION ['search'] = array ();
$ _ SESSION ['search'] = array_merge ($ _ SESSION ['search'], $ _ GET );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.