How can i create a search page with multiple criteria where at least a criteria should be checked.
Table Structure
- ID [pk]
- Name
- Sex
- Location
I want to create a search form where user will be able to search by name or by name,sex or by name,sex,location or any such combination among [name,sex,location]
How to design the query ?
Edit
i am not asking for checking atleast a single option has value [js validation], i am asking for the query !
I'll use mysqli prepared statement !
You can check to see if the post for a particular field is empty, if it's not then append the corresponding WHERE clause to the query. Something in the form of the following: