salve ragazzi buonasera
in pratica , come leggerete dal titolo, non riesco bene a fare una ricerca avanzata con piu form
il problema in generale e che in una ricerca dinamica non devo per forza riempiere tutti i campi a disposizione ( e nel mio caso ce ne sono molti come : PREZZO da/a , CATEGORIA , TIPO ecc) come fare ??
vi posto il form in html e poi la pagina in php

Codice PHP:
<html>
<
head><title>Ricerca barche</title>
</
head>
<
body>
<
div style="position:absolute; left:25%; top:37%;">
<
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>
     <
th align="center" width="100" valign="bottom"><font color="00549F">Tipo</th>

      
       <
tr><td align="center" width="100"><select name="velmot" id="vemo">
                              <
option value="Vela/Motore">Vela/Motore</option>
                              <
option value="Vela">Vela</option>
                              <
option value="Motore">Motore</option>
           </
td>
 
      
           <
td align="center" width="100"><select name="group" id="grup">
                               <
option value="Tutto">Tutto</option>
                               <
option value="Affitto">Affitto</option>
                               <
option value="Transito">Transito</option>
                               <
option value="Vendita">Vendita</option>
                              </
select>
                              
           </
td>
 
      
           <
td align="center" width="100"><select name="tipo" id="tipos">
                                
                                <
option value="Tutto">Tutto</option>
                                <
option value="Affitto cerco">Affitto Cerco</option>
                                <
option value="Affitto offro">Affitto Offro</option>
                                <
option value="Cedo vendo">Cedo vendo</option>
                                <
option value="Compro">Compro</option>
                                <
option value="Scambio cerco">Scambio cerco</option>
                                <
option value="Scambio offro">Scambio offro</option>
                              </
select></td></tr>
                             </
td>                             
                             </
table>
  <
tr>
  <
table border="0" align="">
     
           <
th align="center" height="10" valign="bottom"><font color="00549F">Lunghezza</th
           <
th align="center" height="10" valign="bottom"><font color="00549F">Anno</th>
           <
th align="center" height="10" valign="bottom"><font color="00549F">Budget</th>
           <
th align="center" height="10" valign="bottom"><font color="00549F">Opzioni</th>
      
       
      
       <
tr><td>da <input type="text" name="da" size="10" maxlength="200"<input type="text" name="a" size="10" maxlength="200"></td>                        
      
           <
td style="width: 100px; height: 25px; padding: 1px; overflow: auto;"><input type="text" name="year"></td>
      
           <
td>da <input type="text" name="dab" size="10" maxlength="200"<input type="text" name="ab" size="10" maxlength="200"></td>
      
        <
td><select name="opz" id="opzion">
         <
option value="" selected="selected">Tutte</option>
         <
option value="Leasing in corso">Leasing in corso</option>
         <
option value="Finanziamento">Finanziamento</option>
         <
option value="Possibilità di permuta">Possibilita' di permuta</option>
         </td> 
    
         
    <td align="center" width="100">
<input type="submit" value="Cerca" style="background-color:00549F; color:white; width:90; height:25;font-size-adjust:inherit "></td>
    </tr>
    </td>
    </tr>
    </table>
    

     
 </table>
</form>
</div>
</body>
</html> 



pagina in php

Codice PHP:
<?php
include('connessione.php');
include (
"tutto.php");
$velmot$_POST['velmot'];
$group$_POST['group'];
$tipo$_POST['tipo'];
$tipo$_POST['ab'];
$tipo$_POST['dab'];

/* fine costruzione query */

$query "SELECT * FROM postobarca WHERE postobarca.vel LIKE '$velmot' AND postobarca.cat LIKE '$group' ";
$risultato mysql_query($query)

or die(
"Query non valida: " mysql_error());
$num=mysql_num_rows($risultato);
IF (
$num == 0
 {  echo (
"Il database è vuoto");
     exit();
  }
mysql_close($conn);
// Se ci sono file nel DB
 
?>
<?
include("ricercahtm.php");
?>
    <style type="text/css">
        
        tr {
        
            background-color: #efefef;
        }
        
        tr:hover {
            background-color: #dedede;
        }

    </style>

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
    <script type="text/javascript">
        $(function(){
            $('tr').hover(function(){
                $(this).css('background','#dedede');
            }, function(){
                $(this).css('background','#efefef');
            });
        });
    </script>

<BODY>
<div style="position:absolute; left:7%; top:33%;">
[url="INDEX.php"][b]<font face="Arial" size="2" color="DIMGRAY">Home page  ></font>[/b][/url]
[b]<font face="Arial" size="2" color="003c69">Elenco di Postobarche</font>[/b]

</div>
<div style="position:absolute; left:7%; top:34%;">
<font face="Arial" size="1" color="gray">__________________________________________________________________________________________________________________________________________________________________________________________</font>
</div>
<div style="position:absolute; left:7%; top:37%;">
[img]postobarca_box.png[/img]
</div>
[b]<font color="black" face="arial" size="2" style="left: 60%; top:57%;  position:absolute">Ordina per :[/b]</font>
[b]<font color="black" face="arial" size="2" style="left: 70%; top:57%;  position:absolute">||[/b]</font>
[url="ordinaprezzoposto.php"][b]<font color="003c69" face="arial" size="2" style="left: 66%; top:57%;  position:absolute">prezzo</font>[/b][/url]
[url="postobarca.php"][b]<font color="003c69" face="arial" size="2" style="left: 71%; top:57%;  position:absolute">data</font>[/b][/url]
<font face="Arial" size="1" color="gray" style="left: 7%; top:59%;  position:absolute">__________________________________________________________________________________________________________________________________________________________________________________________</font>
<TABLE cellspacing="1" cellpadding="12" border=1 bordercolor="LIGHTGRAY" style="left: 7%; top:62%; position:absolute; border: 1px solid #ffffff;">
<TR>
<TH style="border: 1px solid #CDCDCD; background-color:003c69;"><font face="arial" color="white">data ins.</font></TH>
<TH style="border: 1px solid #CDCDCD; background-color:003c69;"><font face="arial" color="white">foto</font></TH>
<TH style="border: 1px solid #CDCDCD; background-color:003c69;"><font face="arial" color="white">id</font> </TH>
<TH style="border: 1px solid #CDCDCD; background-color:003c69;"><font face="arial" color="white">ubicazione</font></TH>
<TH style="border: 1px solid #CDCDCD; background-color:003c69;"><font face="arial" color="white">postobarca presso</font></TH>
<TH style="border: 1px solid #CDCDCD; background-color:003c69;"><font face="arial" color="white">lung.</font></TH>
<TH style="border: 1px solid #CDCDCD; background-color:003c69;"><font face="arial" color="white">larg. </font></TH>
<TH style="border: 1px solid #CDCDCD; background-color:003c69;"><font face="arial" color="white">categoria</font></TH>
<TH style="border: 1px solid #CDCDCD; background-color:003c69;"><font face="arial" color="white">tipologia</font></TH>
<TH style="border: 1px solid #CDCDCD; background-color:003c69;"><font face="arial" color="white">prezzo</font></TH>
</TR>
<?php
$i
=1;
while( 
$tmp mysql_fetch_array($risultato))
 {
?>  
   <tr>  
   <TD style="border: 1px dotted #708090">[b]<font face="arial" size="2"><?php echo date($tmp["data1"]); ?></font>[/b]</TD>
   <TD align="center" style="border: 1px dotted #708090">[img]ADMIN/open.php?id=<?php echo $tmp[[/img]" width="120" height="90">
   


   <FORM action="
singolo1.php?id=<?php echo $tmp['id'?>" method="post" name="ricerca"> 
   <input type="image" img src="botton-vai-annuncio.png">
   </form>
   </TD>
   <TD style="border: 1px dotted #708090;">[b]<font face="arial" size="2"><?php echo ($tmp["id"]); ?></font>[/b]</TD>
   
   <TD style="border: 1px dotted #708090;"><p align="center">[b]<font face="arial" size="2"><?php echo ($tmp["regione"]); ?>/<?php echo ($tmp["provincia"]); ?></font>[/b]</TD>
   <TD style="border: 1px dotted #708090;"><p align="center">[b]<font face="arial" size="2"><?php echo ($tmp["titolo"]); ?></font>[/b]</TD>
   <TD style="border: 1px dotted #708090;"><p align="center">[b]<font face="arial" size="2"><?php echo ($tmp["lung"]); ?>.00 mt</font>[/b]</TD>
   <TD style="border: 1px dotted #708090;"><p align="center">[b]<font face="arial" size="2"><?php echo ($tmp["larg"]); ?>.00 mt</font>[/b]</TD>
   <TD style="border: 1px dotted #708090;">[b]<font face="arial" size="2"><?php echo ($tmp["cat"]); ?></font>[/b]</TD>
    <TD style="border: 1px dotted #708090;">[b]<font face="arial" size="2"><?php echo ($tmp["tip"]); ?></font>[/b]</TD>
    <TD style="border: 1px dotted #708090;"><p align="right">[b]<font face="arial" color="003c69" size="3"><?php echo number_format($tmp["prezzo"]); ?>,00</font>[/b]</TD>
    </TR>  
<?php
 
}
 
?>
[b]<font color="003c69" face="arial" size="3" style="left: 7%; top:57%;  position:absolute">Postobarca trovati : <? include("contposto.php"?>[/b]</font>
<?
?>
</TABLE>