How to make a search form for multiple values

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mikes1471
Forum Commoner
Posts: 88
Joined: Sat Jan 24, 2009 3:29 pm

How to make a search form for multiple values

Post by mikes1471 »

Hi Guys

I want to create a user search form on one page and to display the values/users on the following page.

The search page will be made up mainly of drop down lists such as Gender, minimum age, maximum age, location etc, basically the same old form you find on a dating/social networking website.

I need someone to tell me the steps involved as I'm unsure how to display user defined criteria.
User avatar
Weiry
Forum Contributor
Posts: 323
Joined: Wed Sep 09, 2009 5:55 am
Location: Australia

Re: How to make a search form for multiple values

Post by Weiry »

Should be rather simple, take the input you want from a form, submit to a search page which performs an SQL query with a lot of statements in your WHERE clause.

Code: Select all

SELECT * FROM `users` WHERE `gender` = 'Male' AND `city` = 'MyTown` AND `age` < '55' AND `age` > '23'  ...etc
Something along those lines at least.
Post Reply