Buongiorno a tutti. Sto impazzendo per una cosa che sicuramente è stupidissima ma in questo momento non mi viene in testa.
Allora, ho un form che preleva dati da un db mysql:
Codice PHP:
$query = "SELECT * FROM prodotti order by prod_sint asc";
// invio la query
$result = mysql_query($query);
// controllo l'esito
if (!$result) {
die("Errore nella query $query: " . mysql_error());
}
while ($row = mysql_fetch_assoc($result))
{
$idProdotto = htmlspecialchars($row['idProdotto']);
$prod_sint = htmlspecialchars($row['prod_sint']);
$prod_dett = htmlspecialchars($row['prod_dett']);
$IdForn = htmlspecialchars($row['IdForn']);
$note = htmlspecialchars($row['note']);
$costo = htmlspecialchars($row['costo']);
?>
<form name="sel_prodotti" method="post" action="test_controllo2.php">
<tr>
<td><?php echo '<input style="border:0px;" type="text" name="prodotto[]" value="'.$prod_sint.'">';?></td>
<td><?php echo '<input style="border:0px;" type="text" name="forn[]" value="'.$forn.'">';?></td>
<td><?php echo '<input style="border:0px;" type="text" name="note[]" value="'.$note.'">';?></td>
<td><?php echo '<input style="border:0px;" type="text" name="quantita[]" value="'.$quantita.'">';?></td>
<td><?php echo '<input style="border:0px;" type="text" name="costo[]" value="'.$costo.'">';?></td>
<td><?php echo '<input type="checkbox" name="check[]" value="'.$idProdotto.'">';?></td>
</tr>
<?php
}
?>
Praticamente se checked ho bisogno di sapere quale prodotto, la quantità etc della riga.
E qui vengono i problemi.
Nel test_controllo2.php non mi viente in mente come prendere i risultati delle quantità e dei check.
Ho provato in varie maniere ma essendo gli array di quantità e di check di lunghezza diversa non so come raffrontarli (gli indici non corrispondono).
Qualche idea?
Grazie a tutti