Hi all!! Am trying to post a form, with a whole bunch of information on it - that I have put into an array
This is pretty similar to the form I am using
<form action="dev.php" method="post">
<input type="hidden" name="userID[]" value="$dbuserid">
<input type="text" name="firstname[]" value="john">
<input type="submit" value="update[]" name="submit">
</form>
The number of rows in that form will vary based on how many records are in the table.
Am trying this to return the result...
$user = $_POST['userID'];
foreach($user as $key => $userValue){
$firstname = $_POST[$key.'firstname'];
echo "The User ID returned is $userValue, for $firstname.<br>";
}
The only thing it is putting on the screen is the $userID value and a . on each line (no $firstname), where what I am actually wanting it to do is print the relevant firstname for the userID's that have come through in the array.... what am I doing wrong here?
Ultimately I am hoping to write some queries to put this information into the database, but would like to check the information on the screen first...
Thanks in advance!