hello everyone.
I had this thread going before, and I really started to change the focus, and had a much more specific question.
I am creating a signup form where a validation occurs, and during this validation, a user signifies how many entries they would like to add (to a mysql database).
My problem deals with posting the array to the database correctly.....i can not get the syntax correct.
here is my form:
if ($submit) {
// process form
$db = mysql_connect("..", ".....", "........");
mysql_select_db(".....",$db);
$sql = "INSERT INTO runner (first,last,age) VALUES ('$first','$last','$age')";
$result = mysql_query($sql);
echo "Thank you for registering your team members. \n"
;
} else{
?>
<table border="2" width="100%"><tr><td>
<form method="post" action="<?php echo $PHP_SELF?>" onSubmit="return Validator(this);">
<table width="100%" border="0">
<?
$row = 5;
for ($i = 0; $i < $row; $i++) {
echo"
<tr><td>
First Name: <input type=\"Text\" name=\"first[$i]\" size=\"10\">
Last Name: <input type=\"Text\" name=\"last[$i]\" size=\"10\">
Age: <input type=\"Text\" name=\"age[$i]\" size=\"5\">
</td></tr>";
}
?>
<input type="Submit" name="submit" value="enter information">
</form>
</table>
<?php
} // end if
?>
How do i pass these $rows as individual rows with ONE submit button?
Would it be something to this effect:
foreach($first as $value)
{
???????
}
How would i loop a foreach to include this row array?
Thanks in advance,
-Michael