title: How to add dynamic textbox (row) and save to database using PHP
body: <p>I have here my Javascript code that adds dynamic textbox (row) my problem is how can I save the values from the dynamic textbox to database using PHP script? Hope you can help me guys.. Thanks!</p>
  
  <pre><code>&lt;script type="text/JavaScript"&gt; 
    function addRow(r){ 
    var root = r.parentNode;//the root 
    var allRows = root.getElementsByTagName('tr');//the rows' collection 
    var cRow = allRows[0].cloneNode(true)//the clone of the 1st row 
    var cInp = cRow.getElementsByTagName('input');//the inputs' collection of the 1st row 
    for(var i=0;i&lt;cInp.length;i++){//changes the inputs' names (indexes the names) 
    cInp[i].setAttribute('name',cInp[i].getAttribute('name')+'_'+(allRows.length+1)) 
    } 
    root.appendChild(cRow);
    } 
    function shownames(){ 
    var allInp=document.getElementsByTagName('input'); 
    for(var i=0;i&lt;allInp.length;i++){ 
    alert(allInp[i].name) 
    } 
    } 
    &lt;/script&gt; 
  </code></pre>
  
  <p>My HTML code:</p>
  
  <pre><code>   &lt;form method="POST" action="#"&gt; &lt;table width="1024" border="0" cellspacing="6" cellpadding="0"&gt; &lt;tr&gt;
        &lt;td width="195"&gt;&lt;div class="user"&gt;&lt;input type="text" name="user_a" id="user"  tabindex="6"/&gt;&lt;/div&gt;&lt;/td&gt; 
      &lt;td width="410"&gt;&lt;div class="reported"&gt;&lt;input type="text" name="user_b" id="reported" tabindex="7"/&gt;&lt;/div&gt;&lt;/td&gt; 
      &lt;td width="399"&gt;&lt;div class="reported"&gt;&lt;input type="text" name="user_c" id="reported" tabindex="8"/&gt;&lt;/div&gt;&lt;/td&gt; 
      &lt;td width="10"&gt;&lt;input name="button" type="button" value="+" onclick="addRow(this.parentNode.parentNode)"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt;
  </code></pre>