Codice PHP:
$where = "";
if(isset($_GET["categoria"]))
$where .= " categoria = '".$_GET["categoria"] . "' and";
if(isset($_GET["provincia"]))
$where .= " provincia = '".$_GET["provincia"] . "' and";
if($where != "")
$where = substr($where,0,strlen($where)-3); // questo toglie l'eventuale and rimasta "orfana"
if($where != "")
$where = " WHERE $where"; // ho separato questa istruzione dalla prec per facilità di lettura
$sql = "SELECT * FROM tabella $where";