$sql = "select * from table where 1=1";
if(isset($_POST['a']) and !empty($_POST['a'])){
$sql .= " and field1 like '%" . $_POST['a'] . "%'";
}
if(isset($_POST['b']) and !empty($_POST['b'])){
$sql .= " and field2 like '%" . $_POST['b'] . "%'";
}
if(isset($_POST['c']) and !empty($_POST['c'])){
$sql .= " and field3 like '%" . $_POST['c'] . "%'";
}