0👍
✅
In PHP, values with the same name
attribute value will get overwritten. (See the “How do I get all the results from a select multiple HTML tag?” section here).
You can create arrays of values by adding a bracket to the name. For example, if you made the name
of the “name” input name[]
, name
will be an array of names in PHP.
In your case, you could use this format: name="guarantors[][name]"
. That way you will get an array in PHP under the key guarantors
(e.g. $request->guarantors
) and each of the values in guarantors
will be an array with the values name
, email
, etc.
Source:stackexchange.com