This is easy. Just get your request variables from the querystring. If they're not there, set them to "" or NULL....
$keywords = $_GET["keywords"];
$criteriaId = $_GET["criteriaId"];
$dateEntered = $_GET["dateEntered"];
$statusID = $_GET["statusID"];
... and call the function:
$orders = searchOrders($keywords, $criteriaId, $dateEntered, $statusID);
In the searchOrders function, you may check if value for any parameter is "" (blank) or NULL and create your SQL query accordingly.
Edit:
The trick here is to play with where and and keywords. (Assuming you need only a where / and condition query and include a parameter if its value is not blank or NULL)
public function searchOrders($keywords, $criteriaId, $dateEntered, $statusID)
{
$query = "select * from orders";
$condition = " where ";
if (!is_null($keywords)) {
$query .= $condition . "keywords like '$keywords'";
$condition = " and ";
}
if (!is_null($criteriaId)) {
$query .= $condition . "criteriaId = $criteriaId";
$condition = " and ";
}
if (!is_null($dateEntered)) {
$query .= $condition . "dateEntered <= #$dateEntered#";
$condition = " and ";
}
if (!is_null($statusID)) {
$query .= $condition . "statusID = $statusID";
}
return mysql_query($query) or die (mysql_error);
}
Hope this helps!
Vivek