Prova questo.
File : test319.php
Codice PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><?php
if (isset($_POST['bottone'])) {
if ($_POST['bottone'] == "Invia") {
foreach($_POST['prodotto'] as $key => $value) {
print "prodotto chiave=$key valore=$value<br/>";
} // foreach($_POST['prodotto'] as $key => $value)
print "<hr/>";
foreach($_POST['fornitore'] as $key => $value) {
print "fornitore chiave=$key valore=$value<br/>";
} // foreach($_POST['fornitore'] as $key => $value)
print "<hr/>";
foreach($_POST['descrizione'] as $key => $value) {
print "descrizione chiave=$key valore=$value<br/>";
} // foreach($_POST['descrizione'] as $key => $value)
print "<hr/>";
foreach($_POST['quantita'] as $key => $value) {
print "quantita chiave=$key valore=$value<br/>";
} // foreach($_POST['quantita'] as $key => $value)
print "<hr/>";
foreach($_POST['prezzo'] as $key => $value) {
print "prezzo chiave=$key valore=$value<br/>";
} // foreach($_POST['prezzo'] as $key => $value)
print "<hr/>";
} // if ($_POST['bottone'] == "Invia")
} // if (isset($_POST['bottone'])) ?>
<html>
<head>
<title>Untitled</title>
</head>
<body>
<form action="test319.php" method="post">
<table>
<th>Prodotto</th><th>Fornitore</th><th>Descrizione</th><th>Quantita</th><th>Prezzo</th><?php
$i=1;
for($i=1;$i<=10;$i++) { ?>
<tr>
<td><input type="text" name="prodotto[]" /></td>
<td><input type="text" name="fornitore[]" /></td>
<td><input type="text" name="descrizione[]" /></td>
<td><input type="text" name="quantita[]" /></td>
<td><input type="text" name="prezzo[]" /></td>
</tr><?php
} // for($i=1;$i<=10;$i++) ?>
</table>
<input type="submit" value="Invia" name="bottone" />
</form>
</body>
</html>
Capito il concetto ?