K
K
Kipsy2021-06-14 18:31:56
PHP
Kipsy, 2021-06-14 18:31:56

Is it possible to get in php when submitting a form all elements with the same name fields?

Hello. I have such a problem. I need to submit a form with multiple fields via email. Usually when I sent earlier, each input had its own name and I found it in php and sent it, but now I got it so that there were initially divs inside the form, then I passed their values ​​\u200b\u200bthrough js to the hidden input in value and set them all the same name . It is not known in advance how many elements will be created. How can you already collect all these elements through php and send them to the mail? In essence, it is similar to the operation of the basket. There the user adds something. A div is created dynamically - in the same place, the data from it falls into the hidden input created in the same way, and I pass these inputs to php via fetch and how can I process them all there at once?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2021-06-14
@Kipsi

with the same name attribute , only one value will be sent.
however, you can define them as an array:<input type="text" name="foo[]">

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question