Seguinte, eu tenho aq uma tabela dinâmica funcionando perfeitamente, mas meu problema é o seguinte, quando eu vou dar o submit no form e mandar os dados pro php para serem gravados do BD eu não sei como pegar os dados dos inputs, pois não sei o nome dos mesmos.
Aqui a função juntamente com a tabela:
<script> var d = document ; window.onload = function(){ d.getElementById( 'firstLink' ).onclick = function(){ removerTr( 1 ) } d.getElementById( 'add' ).onclick = function(){ var oTable = d.getElementById( 'tabela' ) ; var newTr = oTable.insertRow( -1 ) ; newTr.setAttribute( 'id' , 'row' + oTable.rows.length ) ; newTr.insertCell(0).appendChild( getLinkExcluir( oTable.rows.length ) ) ; newTr.insertCell(1).appendChild( getInput() ) ; newTr.insertCell(2).appendChild( getInput() ) ; newTr.insertCell(3).appendChild( getInput() ) ; newTr.insertCell(4).appendChild( getInput() ) ; } } function getLinkExcluir( rowId ) { var oA = d.createElement( 'a' ) ; oA.setAttribute( 'href' , '#' ) ; oA.innerHTML = 'excluir' ; oA.onclick = function(){ removerTr( rowId ) ; } return oA ; } function getInput() { var oInput = d.createElement( 'input' ) ; oInput.setAttribute( 'name' , 'inputs[]' ) ; return oInput ; } function removerTr( rowId ) { var iRow = d.getElementById( 'row' + rowId ).rowIndex ; d.getElementById( 'tabela' ).deleteRow( iRow ) ; return false ; } </script>
e Aqui o Html:
<form> <table id='tabela'> <tr id='row1'> <td><a id='firstLink' href='#'>excluir</a></td> <td> <input type="text" name='inputs[]'> </td> </tr> </table> <div><input type="submit"></div> </form> <button id='add' type='button'>Adicionar</button>
como veêm ele usa um array para guardar o nome de cada linha adicionada, mas eu não estou conseguindo visualizar este nome, quando eu der o submit como é q eu vo pegar la no php os nomes dos inputs por exemplo: $nome = $_POST['??????'];