Hi,
I have 2 form elements which are arrays.
<input type=\"text\" name=\"text[]\" value\"$text\" />
<input type=\"text\" name=\"textid[]\" value\"$textid\" />
When the user posts this form I need to update my table records with the values of $text using the id found in textid[] to find that record in my table.
I decided to use this method:
if ($_POST['text']) {
$text = $_POST['text'];
$textid = $_POST['textid'];
foreach($text as $newtext) {
foreach($textid as $key => $value) {
$sqlupdate = "UPDATE mytable SET textvalue = $newtext WHERE textid = $key";
}
}
}
Unfortunately at the moment, when I echo my query, the id field in the WHERE clause is always the same ID and incidentally, it is the LAST ID of the collection of text fields.
What part of this is incorrect?
Many Thanks
K