Suppoendo che abbia questo codice che manda alla pagina insert.php una serie di campi input a matrice formata ta $t righe e 6 colonne
La mia domanda è nella pagina insert.php come posso fare la query per inserire tutte queste righe assieme? La tabella su cui inserire i dati si chiama per esempio tab1 e ha 6 campi a1,a2,a3,a4,a5,a6 dove in ogniuno di essi andrà il correspettivo valore es:Codice PHP:
<form name="form1" action="insert.php" method="post" >
$t=6;
for($i=1;$i<=$t; $i++)
{
for($j=1; $j<=6; $j++)
{
echo("<input name=\"v[$i][$j]\" type=\"text\" size=\"2\" maxlength=\"2\" />");
} }
| a1 | a2 | a3 | a4 | a5 | a6 |
| v[1][1] | v[1][2] | v[1][3] | v[1][4] | v[1][5] | v[1][6] |
| v[2][1] | v[2][2] | v[2][3] | v[2][4] | v[2][5] | v[2][6] |
| ...... | ....... | ...... | ...... | ..... | ...... |
| v[t][1] | v[t][2] | v[t][3] | v[t][4] | v[t][5] | v[t][6] |