$query = "SELECT * FROM table WHERE ";
/*******************************************
check if POST or GET variables are set and contain info
if so, build query based on values - I woud use GET for this,
so users could type in the url into the location
******************************************/
if (isset($GET["var1"]) && $GET["var1"] !=""){
$query .= "column1 = '$GET[var1]' AND ";
}
if (isset($GET["var2"]) && $GET["var2"] !=""){
$query .= "column2 = '$GET[var2]' AND ";
}
.
.
.
/***************************************
and you can end the query like so....
$GET["var3"] could be a radio select form input with the
same name for each input -
EX
<input type='radio' name='var3' value='this1'>
<input type='radio' name='var3' value='this2'>
<input type='radio' name='var3' value='this3'>
THEN---
****************************************/
if (isset($GET["var3"]) && $GET["var3"] !=""){
if ($GET["var3"] == "this1"){
$query .= "column3 is not null";
} elseif ($GET["var3"]] == "this2"){
$query .= "column3 is null";
} elseif ($_GET["var3"] == "this3"){
$query .= "column3 > column4";
}
} else {
/************************************
we don't want AND at the end of the query
*****************************************/
$query = substr($query,"",-4);
}
Hope this helps...