I have in a db 2 columns (nome and cores).
For each one of the columns i have to insert 3 rows.
I can´t organize the submitted values and put them in their respective column!
Can you help me with that loop, it´s doesn´t seam to work:
<?
for($i=1;$i<=3;){
?>
<td width="24%"><input name="cores<? echo $i; ?>" type="text" id="cores"></td>
<td width="76%"><input name="nome<? echo $i; ?>" type="text" id="nome"></td>
<? } ?>
$insertSQL = "INSERT INTO teste (nome, cores) VALUES ";
$maxval = max($HTTP_POST_VARS);
echo $maxval;
for ($i = 1; $i < $maxval;) {
$insertSQL .= "('\"$nome\"', '\"$cores\"') ,";
$i++;
}
$insertSQL .= " (NULL, NULL) ";
$Result1 = mysql_query($insertSQL, $vidisco);