There’s a pretty nifty trick to group form elements in a way the form submission is formatted as an array.
The problem is, Webflow doesn’t respect the formatting.
I’ve tried using the Webflow default form action - doesn’t work - and using a custom webhook - worked.
For example, if you have a form:
Person 1:
First name
Email
Person 2:
First name
Email
If you name your form fields like the following:
Person 1:
<label>First name</label>
<input name="people[1][first_name]">
<label>Email</label>
<input name="people[1][email]">
Person 2:
<label>First name</label>
<input name="people[2][first_name]">
<label>Email</label>
<input name="people[2][email]">
The form submission will be formatted as an array and it’s going to be much easier to parse.
people = [
[
'first_name' => 'Jim',
'email' => 'jim@barber.com
],
[
'first_name' => 'Amira',
'email' => 'amira@sayegh.com
]
]
You can read more about this trick here: