Maybe if I show u what I did u will understand:
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
require_once('../Connections/vidisco.php'); ?>
<?
if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {
for($i=1;$i<="3";){
$n = "name".$i;
$c = "cores".$i;
$namex = $HTTP_POST_VARS["$n"];
$coresx = $HTTP_POST_VARS["$c"];
echo $namex;
/* $insertSQL = sprintf("INSERT INTO teste (name, cores) VALUES (%s, %s)",
GetSQLValueString($namex, "text"),
GetSQLValueString($coresx, "text"));
mysql_select_db($database_vidisco, $vidisco);
$Result1 = mysql_query($insertSQL, $vidisco);
echo mysql_errno() . ": " . mysql_error(). "\n"; */
$i++;
}
}
?>
<form action="index.php" method="post" enctype="application/x-www-form-urlencoded" name="form1">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>cores</td>
<td>name</td>
</tr><?
for($i=1;$i<="3";){
?>
<tr>
<td width="24%"><input name="cores" type="text" id="cores<? echo $i; ?>"></td>
<td width="76%"><input name="name" type="text" id="name<? echo $i; ?>"></td>
</tr>
<? $i++;
}
?>
<tr>
<td><input name="cores" type="text" id="cores"> <input type="hidden" name="MM_insert" value="form1"></td>
<td><input name="name" type="text" id="name"> <input type="submit" value="Submit"></td>
</tr>
</table>
</form>
I´m trying to generate multiple form values to put in the same table:
1 name1 cores1
2 name2 cores2
3 name3 cores3
4 name4 cores4
get all this and put to the table:
name cores
using a single submission form
Sorry for my bad english!
Thanx for any help!