I dont have any idea about php. But here is the logic.In case of filter search you have to create dynamic query. Dynamic query is not just complex , its a simple query which is creating depending the user choice.
sql= "Select .<add the="" column="" name="" to="" display="">...from <tablename>";
//not complete missing where condition
Now check
define variable condition;
if(name given){
condition +=" name = '<add_name_field_value>'";
}
if(condition not emtp){
condition +=" and ";
}
if(city given){
condition += " city = '<add_city_field_value>'";
}
and so on
finally add the where clouse
if(condition not emtp){
condition =" where "+condition;
}
Now sql = sql+condition;
</add_city_field_value></add_name_field_value>
Your dynamic sql query ready
enjoy