I have knowledge in CRUD (Create, Read, Update and Delete) of MySQL PHP but in a last project of warehouse I wanted to make a form that the more inputs are requested, more rows of form can be added, but this I do not know how to add a id
or name
to receive in the php without problems.
This is the script method that I use to add new rows of fields:
<script type="text/javascript">
function add(){
var elemento = document.createElement("li"), contenido = document.createTextNode("Nueva Lista");
elemento.appendChild(contenido);
var padre = document.getElementsByTagName("li")[0].parentNode;
padre.appendChild(elemento);
}
function add2(){
var fila = document.createElement("tr"),
celda2 = document.createElement("td"),
celda3 = document.createElement("td"),
celda4 = document.createElement("td");
var text2 = document.createElement("input");
var text3 = document.createElement("input");
var text4 = document.createElement("input");
celda2.appendChild(text2);
celda3.appendChild(text3);
celda4.appendChild(text4);
fila.appendChild(celda2);
fila.appendChild(celda3);
fila.appendChild(celda4);
var tabla = document.getElementsByTagName("tr")[0].parentNode;
tabla.appendChild(fila);
}
</script>
Someone could make a simple example with a single field by adding it and that in a simple database they receive this data together without problems.
Thanks in advance.