<form action="stampa.php" name ="stampa" method ="post"/>
<?php
mysql_connect("localhost","user","pass");
mysql_select_db("tbl");
//ho un campo FLAG nel DB
$query = "SELECT * FROM tbl where FLAG = true ";
$result = mysql_query($query) or die(mysql_error());
while($resrow =mysql_fetch_array($result)){
?>
<table width="425" border="1" cellspacing="2" cellpadding="0"/>
<tr>
<td> <input type="checkbox" name="flag[]" value="<?=$resrow['id']?>" <?php $resrow['FLAG'] == '1' ? print 'CHECKED' : print 'UNCHECKED';?>/> </td>
<td> <?=$resrow['id']?></td>
<td> <?=$resrow['targa']?> </td>
</tr>
</table>
<?} ?>
<input type ="submit" name ="stampa" value ="Stampa" />
</form>
</body>
</html>
questo il file di controllo per la stampa:
<?php
if(isset($_POST['flag'])){
$checkBox = $_POST['flag'];
foreach($checkBox as $key => $value)
{
//var_dump($checkBox);
echo "Elemento con ID ".$value." selezionato per la stampa";
//qui le istruzioni successive
}
}else{
print "Nessun elemento selezionato per la stampa";
}
?>
cambia i nomi dei campi e quelli delle variabili....per le tue esigenze