codice:
$whereClause = "";
if (! empty($stato_sel)) { 
 $whereClause = " AND stato='$stato_sel' "; 
} 

if (! empty($secondo_sel)) { 
 $whereClause = " AND stato='$secondo_sel' "; 
} 

if (! empty($terzo_sel)) { 
 $whereClause = " AND stato='$terzo_sel' "; 
} 

if (! empty($quarto_sel)) { 
 $whereClause = " AND stato='$quarto_sel' "; 
} 

$queryvar = "select * from tabella WHERE 1 $whereClause ";