<?php
$cn = mysql_connect("localhost", "user", "");
mysql_select_db("my_DB", $cn);
//leggi il valore che ti provine dal form
$testo=trim($_POST['testo']);
$testo = substr("00000000".$_POST["testo"], -8);//inserisce gli zeri prima del telaio
$newpage = '../dettagli/formcerca.php';
$wh="";
if(!empty($testo) && preg_match('/^[a-zA-Z0-9]{1,8}/',$testo)){
    $wh=" WHERE DATO9='".$testo."'" ;//o se nel $_POSTO hai messo $box qui ci va $box
    //doveil nome del campo su cui fare la ricerca lo sai tu
        $sel = "SELECT* FROM completo $wh";
       
    //var_dump($sel); LO COMMENTI
   
    $query = mysql_query($sel, $cn );
   
    $quanti = mysql_num_rows($query);
    if ($quanti == 0){
        echo "<h1>TELAIO ERRATO OPPURE INESISTENTE!</h1>";header('Refresh: 3; url=' . $newpage);
    }else{
        while($rs=mysql_fetch_array($query)){
            //ti converrebbe mettere il nome del campo che visualizzi es al posto di $rs[2] mettere $rs['pinco']
               
           echo "<tr> <h1><center>DETTAGLI RICHIESTI :"."<br><br><hr>";
         
            echo "<td> " . $rs[5] . "</td> ";
            echo "<td>" . $rs[9] . "</td> ";
            echo "<td>" . $rs[29] . "</td> ";
            echo "<td>" . $rs[23] . "</td>";
           echo "<td>" . $rs[24] . "</td>";
           echo "<td>" . $rs[26] ." - ". $rs[27] . "</td>";
           echo "<td>" . $rs[50] . "</td>";
           echo "<td>" . $rs[52] . "</td>";
                 echo'<td>
           
<form method="post" action="salva_telai/modulosalvatelai.php" >
        <input type="checkbox" multiple="true"
         name="myCheck['.$rs[5].'-'.$rs[9].'___'.$rs[26].' - '.$rs[27].'___'.$rs[24].'___'.$rs[52].']"
         value="TELAIO" />
               
               
               
               
</center></h1><br></tr></td> ';
     }  
    }
}else{
    echo "<h1>NON HAI INSERITO NULLA!</h1>";header('Refresh: 3; url=' . $newpage);
}
 
mysql_close($cn);
?>