I have sets of input fields:
<input type="text" name="data[question_id][]" value="6" />
<input type="text" name="data[position][]" value="50" />
<input type="text" name="data[answer][]" value="London" />
<input type="text" name="data[question_id][]" value="6" />
<input type="text" name="data[position][]" value="60" />
<input type="text" name="data[answer][]" value="New York" />
Here's my output:
array (
'question_id' =>
array (
0 => '6',
1 => '6',
),
'position' =>
array (
0 => '50',
1 => '60',
),
'answer' =>
array (
0 => 'London',
1 => 'New York',
),
)
However, I need the array to be in the following format:
array (
0 =>
array (
'question_id' => '6',
'position' => '50',
'answer' => 'London',
),
1 =>
array (
'question_id' => '7',
'position' => '60',
'answer' => 'New York',
),
)
I tried placing the brackets after data (data[][question_id]), but the array becomes even more convoluted. Thank you for your time!
data[0][question_id]etc?