Firstly, I assume the data sits in a MySQL database. If that's true, you can use the LIKE statement in a MySQL query, and wildcards to capture all the data you want in 1 query.
I assume you have a series of dropdown menus for the various values for 'seller', 'region', etc. If they're textboxes, use something like:
PHP Code:
if(!isset($_POST['var']))
{
$_POST['var'] = '%';
}
Basically what you want is the value of $_POST['var'] to be '%' for anything that the user isn't searching by. (For dropdowns for any use <option value='%'>Any</option>)
Then you want to include all of the things you can search by in the SQL query. For example:
Code:
SELECT * FROM sales WHERE Region LIKE '$_POST[region]' AND Seller LIKE '$_POST[seller]'
In that example, if $_POST[region] = '%', then it will select where region is anything, and seller is whatever is said in the form. (In effect, allowing a user to search for any number of the search terms, but still using 1 query). The important part is to use 'LIKE' instead of '=' in the query.
Bookmarks