Keep index every time you add a new group of form fields (uses jQuery):
window.count = 0;
$('#add-more-button').on('click', function() {
$('<input name="html_array[' + window.count + '][title] />').appendTo('form:first');
$('<input name="html_array[' + window.count + '][amount] />').appendTo('form:first');
window.count++;
});
You should get the right structure.
Edit if you mean PHP:
foreach($my_array as $key => $value) {
echo '<input name="html_array[' . $key . '][title]" />';
echo '<input name="html_array[' . $key . '][value]" />';
}
source
share