Buongiorno a tutti,
Problemino..chissa' se qualcuno riesce ad aiutarmi.
Volevo affiancare ad ogni riga estratta da tabella DB,una scelta da fare per l'utente tramite checkbox.
form.html
cerca.php
Mi estrae perfettamente le righe che chiedo al DB in tabella etc etc..
Io vorrei appunto affiancare ad ogni riga un checkbox dove l'utente seleziona,a volte anche tra 300 righe,la sua scelta e lo invia ..
Si puo' fare secondo voi e come?
Grazie in anticipo a tutti
Problemino..chissa' se qualcuno riesce ad aiutarmi.
Volevo affiancare ad ogni riga estratta da tabella DB,una scelta da fare per l'utente tramite checkbox.
form.html
Codice:
<form method="post" action="cerca_disponibile.php">
<h1>ZONA:</h1>  <input type="text" name="testo" ><br><br>
<input type="image" src="http://MIOSITO.altervista.org/registrazione_utenti/images/CERCA_DISPONIBILE.png"/>
</form>
cerca.php
Codice:
<table id="box-pieno" >
<tr>
<th scope="col">PIPPO</th>
<th scope="col">CORREDO</th>
<th scope="col">COLORE</th>
<th scope="col">BOX</th>
<th scope="col">DESTINO</th>
<th scope="col">POSTO</th>
<th scope="col">COME</th>
</tr>
<style>
#box-pieno
{
background: #000000;
border-collapse: collapse;
font-family: "Arial Black", Gadget, sans-serif ;
font-size: 20px;
width: 700px;
height:150px;
text-align: center;
}
#box-pieno th
{
background: #000000;
border: 1px solid Gainsboro ;
border-top: 4px solid #FFFFFF;
color: #FFFFFF;
font-size: 14px;
font-weight: normal;
padding: 18px;
}
#box-pieno td
{
border: 2px solid #A9A9A9 ;
background: #000999;
color: #ffffff;
padding: 18px;
}
#box-pieno tbody td:hover
{
background: Lime;
color: #000000;
}
</style>
<body>
<center>
<h1>GOCATTOLI DISPONIBILI</h1><hr><br>
<?php
$cn = mysql_connect("localhost", "USER", "");
mysql_select_db("my_DB", $cn);
//leggi il valore che ti provine dal form
$testo=trim($_POST['testo']);
$newpage = 'http://MIOSITOaltervista.org/registrazione_utenti/giacenza_zona/form_inquiry_disponibile.php';
$wh="";
if(!empty($testo) && preg_match('/^[a-zA-Z0-9]{1,3}/',$testo)){
$wh=" WHERE DATO24='".$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 disponibile $wh";
$query = mysql_query($sel, $cn );
$quanti = mysql_num_rows($query);
if ($quanti == 0){
echo "<h1> CODICE ZONA ERRATO!</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><td> " . $rs[5] . "</td>";
echo "<td> " . $rs[9] . "</td>";
echo "<td> " . $rs[29] . "</td>";
echo "<td> " . $rs[50] . "</td>";
echo "<td> " . $rs[27] . "</td>";
echo "<td> " . $rs[24] . "</td>";
echo "<td>" . $rs[52] . "</td></center></h1>";
}
}
}else{
echo "<h1>NON HAI INSERITO NULLA!</h1>";header('Refresh: 3; url=' . $newpage);
}
mysql_close($cn);
?>
<?php
mysql_connect("localhost", "USER", "");
mysql_select_db("my_DB");
$risultato = mysql_query("SELECT * FROM disponibile $wh");
$num_righe = mysql_num_rows($risultato);
echo "<h1>$num_righe</h1>" ;
?>
<br>
<a href="http://MIOSITO.altervista.org/registrazione_utenti/giacenza_zona/ordina_aggiunta/moduloinvioaggiunta.php"><img src="http://MIOSITO.altervista.org/registrazione_utenti/images/INVIA.png"></a>
<br><br><hr>
</table>
Mi estrae perfettamente le righe che chiedo al DB in tabella etc etc..
Io vorrei appunto affiancare ad ogni riga un checkbox dove l'utente seleziona,a volte anche tra 300 righe,la sua scelta e lo invia ..
Si puo' fare secondo voi e come?
Grazie in anticipo a tutti
Ultima modifica: