Here is the code for the first script:
<form ... >
$anothervar=3;
$count=1;
while ($count <= $anothervar) {
$name="value";
$$name=$count; //name1, name2, name3
echo "<input name=$name><BR>\n";
}
<input type=hidden name=anothervar value=$anothervar>
<input type=submit value=submit>
</form>
The variables get sent to another script:
$count=1;
while ($count <= $anothervar) {
?
mysql_query("INSERT INTO table (field) VALUES (?)");
}
I don't know how to insert the values of $name1, $name2 and $name3. I could say:
$name="name" . $count; or
$name="name$count"; or
$name="name"; $$name=$count;
...VALUES ($name)
but then it would just insert the values name1, name2, name3 and not the contents of variables $name1, $name2, and $name3. How do I get it to insert the variables from the previous script?
Thanks.