I have a problem sending html inputs to php via ajax..I have multiple input fields like so:
<input type="text" name="fields[]['name']" >
Then i send those to php via jquery ajax like so: $.post('test.php',$('#form').serialize,function(data){alert(data)});
In test php i print fields like so print_r($_POST['fields']).
I was hoping for a key=>value multidimensional array but what i get instead is an array like so:
Array
(
[0] => Array
(
[0] => 102
)
[1] => Array
(
[0] => Seo Offsite
)
[2] => Array
(
[0] => 0
)
What is the problem ? How can i get the values like:
Array
(
[0] => Array
(
['id'] => 102
)
[1] => Array
(
['name'] => Seo Offsite
)
[2] => Array
(
['code'] => 0
)
<input type="text" name="fields[][name]" >echo isset($field['name']) ? $field['name'] : NULL;and then add that line for the other fields aswell. (replaced the name with id and code (and so on))<input type="text" name="fields[name][]" >