'How to get data form Same <form> with many <input type='file' multiple /> elements as separate set for each input field?
I have a with 3 tags as given below;
<input type="name" class="form-control" id="name" placeholder="Enter name" name="name[]">
<input type="text" class="form-control" id="phone" placeholder="Enter phone" name="phone[]">
<input type="file" name="Image[]" id="image" multiple />
I enter record of 2 persons. I select 2 images for 1st person and 3 images for 2nd person. When I submit form then I receive data as following;
Array
(
[name] => Array
(
[0] => Mr A
[1] => Mr B
)
[phone] => Array
(
[0] => 1234567
[1] => 9876543
)
[Image] => Array
(
[0] => 1 (1).png
[1] => 1 (2).png
[2] => 1 (3).png
[3] => 1 (4).png
[4] => 1 (5).png
)
[submit] => Submit
)
Problem is, How can I identify which images belongs to which person. I need data as separate set for each person as following
Array
(
[name] => Array
(
[0] => Mr A
[1] => Mr B
)
[phone] => Array
(
[0] => 1234567
[1] => 9876543
)
[Image] => Array
(
[0] => Array
(
[0] => 1 (1).png
[1] => 1 (2).png
)
[1] => Array
(
[0] => 1 (3).png
[1] => 1 (4).png
[2] => 1 (5).png
)
)
[submit] => Submit
)
Please help in this context
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
