unexpected results using pdo AND OR-Collection of common programming errors

I am working on search form with multiple filters ..but having unexpected results M doing it using PDO. and created query based on url…ursing if,for statements

Url:lType=sale&gender=M|F&loc=can|india|asia

 SELECT * FROM table WHERE 1=1 AND type like :ltype AND location IN (:loca0) OR location IN (:loca1) OR location IN (:loca2) AND gender IN (:gend0) OR gender IN (:gend1)

so from url we can understand that i want to get results where type=sale (and) gender=m(or)f and Loc=can(or)idnia(or)asia

but not getting results as expected ..

Thanks…

UPDATE

As anwsred by user876345 i tried to modify my loop to bind locations

if(isset($_GET['loc'])){        //locations
for($i=0;$i1 && count($aloc)!="$i") {    $sqlsl .=" OR location IN (:loca$i)";}
else if($i>1 && count($aloc)>1 && count($aloc)==$i+1) { $sqlsl .=")";} 
$bind['loca' . $i] = $aloc[$i];
}
} 

but this loop not adding ) at end if theres more than 1 locations and output

SELECT * FROM table WHERE 1=1 AND (location IN (:loca0) OR location IN (:loca1) OR location IN (:loca2)