i'm having some problem with posting data as an array of array. This is how i'd like my data to be POSTED:
array(
['someName'] =>
array([0] =>
array(['description'] =>890
['valore'] =>444)
[1] =>
array(['description'] =>98090
['value'] =>77)
)
I know i can achieve this if my html is like this:
<input type='text' name="someName[0][value]">
<input type='text' name="someName[0][description]">
<input type='text' name="someName[1][value]">
<input type='text' name="someName[1][description]">
My problem is that the input fields are on rows of a table and the user can add/remove as many rows as he want, so i can't have fixed index (or i have to modify the name of the input fields each time a row is added since every time i add a row i clone the upper row in the table)
So what i am asking is one of these two things:
1) is there a way to post data the way i want without specifing an index
2)if not, how can i modify dynamically the new input field so that they have an updated name with the new index?
EDIT - i had alredy tried using name="someName[value][]"
and name="someName[description][]"
but the output is not the desired one:
array(['terreniOneri'] =>
array(['descrizione'] =>array([0] =>890
[1] => 98090)
['valore'] =>array([0] =>444
[1] =>677)
)
i know i can iterate on this array in php i was just wondering if i could avoid it.