cosi boots

Codice PHP:

<form name="campo" method="post" action="ricercaposto.php">
  <
table border="0" align="" bgcolor="#dedede">

     <
th align="center" width="100" valign="bottom"><font color="00549F">Vela/motore</th>
     <
th align="center" width="100" valign="bottom"><font color="00549F">Categoria</th>

       <
tr><td align="center" width="100"><select name="search[velmot]" id="vemo">
        <
option value=""></option>
                              <
option value="Vela/Motore">Vela/Motore</option>
           </
td>

           <
td align="center" width="100"><select name="search[group]" id="grup">
           <
option value=""></option>
                               <
option value="Tutto">Tutto</option>
                               <
option value="Affitto">Affitto</option>
                              </
select>
                              
           </
td

e poi ricercaposto.php e quello che hai fatto tu

Codice PHP:

$conditions 
= array();
foreach(
$_POST['search'] as $key =>$value){
     if(!
$value) continue;
     
// nel caso di select, puoi mettere un option con value nullo
     
switch($key){
         case 
'velmot':
              
$conditions[] = 'velmot LIKE %'.mysql_real_escape_string($value).'%';
        break;
         case 
'cat':
              
$conditions[] = 'cat LIKE %'.mysql_real_escape_string($value).'%';
        break;
     }
}
$sql_conditions implode(' AND '$conditions);


$query "SELECT * from postobarca WHERE $sql_conditions"