When I write a form like this:
<table>
<form>
<tr>
<td><input name="newText" type="text" .../></td>
<td><input type="submit" .../></td>
</tr>
</form>
(repeat the above row several times for dynamically generated content)
</table>
That's incorrect HTML (a warning error is generated in the IDE) and I'm not sure if it will work correctly across all browsers.
I can't put them in seperate tables because that just ruins all the formatting; widths of td's vary across each table depending on the content.
So then I bring the whole form out of the table like this:
<form>
<table>
<tr>
<td><input type="text" name="newText"/></td>
<td><input type="submit" name="action" value="action1"/></td>
</tr>
(repeat rows several times with different values for the 'action' button)
</table>
</form>
Now the problem is that, the last generated record rubs over the newText
value, and so when the form is submitted from the first row, the submitted params look like this:
newText = text1
action = action1
newText = text2
newText = text3
newText = text4
So I know that I need to perform action1
but all I ever get is text4
as the value!
How do I get the right value?
Have you tried:
newText2 = text2
newText3 = text3
.
.
.
or name="newText[]"