0
I have an HTML form, normal input fields, Submit button... Through a JS function, I add additional input fields to a DIV (with innerHTML).
var div = document.getElementById('produtos-adicionados');
div.innerHTML = '<input type='text' class='form-control' name='item' id='item' required='' />';
When you give Submit in the form, I cannot access this new input of name item, obviously.
How could you send the form and get the input value in php? In addition, when submitting the form, you can also obtain the values of the other inputs, which are in the form but are not in innerHTML.
All additional inputs use the
name=item
, repeatedly?– Guilherme Nascimento
this command
div.innerHTML = '...'
works with all these simple quotes?– Ricardo Pontual
The Names of the Gero inputs dynamically and with a counter I increment. Example: first input will have the following name: item0. The following will be called item1, and so on. Same thing for others, where I have: quantity0, quantity1, etc...
– Developer1903
div.innerHTML works with single quotes because the command uses double quotes. Ex: div.innerHTML = "<input type='text' />"
– Developer1903
The element of
id="produtos-adicionados"
is inside the<form></form>
?– Leandro Angelo
Yes, it’s inside the form.
– Developer1903