I am creating a form that users can add extra fields to dynamically and every time a new input is created, it is named accountemails[type] with the type being different for each group.
I want to post this form and retrieve the data grouped by the type
For example, if I have 2 groups - group1 and group2 my inputs would be named:
name="accountemails[group1]"
name="accountemails[group2]"
And there could be multiple with the same group name
For the post in php, I tried
foreach($_POST["accountemails"] as $type => $email) {
}
Which I though would work and I could use $type as each group and then $email for each value but that only shows the last posted input value per group
var_dump($_POST["accountemails"])tell you? ^^foreachloop? And what values does$_POST["accountemails"]contain (see the comment above)?array(4) { ["general"]=> string(2) "g2" ["orders"]=> string(2) "o1" ["renewals"]=> string(0) "" ["accounts"]=> string(0) "" }