This is kinda part two of my "duplicate" here: Why does this multiple row table submit by row? Is this correct?
I modified the original code:
<tr>
<td><input type='text' name='first' value='mark'></td>
<td><button type='submit'name='editbutton' value='1'>Edit</button></td>
</tr>
<tr>
<td><input type='text' name='first' value='luke'></td>
<td><button type='submit'name='editbutton' value='2'>Edit</button></td>
</tr>
<tr>
<td><input type='text' name='first' value='john'></td>
<td><button type='submit'name='editbutton' value='3'>Edit</button></td>
</tr>
to:
<tr>
<td><input type='text' name='first[1]' value='mark'></td>
<td><button type='submit'name='editbutton[1]' value='1'>Edit</button></td>
</tr>
<tr>
<td><input type='text' name='first[2]' value='luke'></td>
<td><button type='submit'name='editbutton[2]' value='2'>Edit</button></td>
</tr>
<tr>
<td><input type='text' name='first[3]' value='john'></td>
<td><button type='submit'name='editbutton[3]' value='3'>Edit</button></td>
</tr>
When reading the post I expected to see a $_POST (php) array containing two main indexes:
['first'] => Array([1] => 'mark', [2] => 'luke', [3] => 'john'),
['editbutton'] => Array([1] => '1', [2] => '2', [3] => '3')
This is not what I got. The 'name' index was properly constructed, but the submit button index 'editbutton' contained only one element, the value of the button pressed. I'd like to count on this but is this correct or am I again counting on the current server's behavior?
Thanks. Sorry if I'm beating a dead horse here.