Another way of doing it:
Frst initialize the variables to empty string:
$search_policy = '';
$search_surname = '';
$search_name = '';
Then you assign a condition to any of the variables if $_POST element exists, as you have done it.
On lines 43 to 45 chremove the else bit from:
else {
$sql = "SELECT * FROM tblclients WHERE clientID > 0".$search_policy.$search_surname.$search_name;
}
to:
$sql = "SELECT * FROM tblclients WHERE clientID > 0".$search_policy.$search_surname.$search_name;
That is how the conditions or empty strings will be added to the query.
@ahmedhamdy: your solution will work only if all three boxes have been filled-in and I am not sure if ngonix wants that.