title: How can I concat the content of dynamic textboxes to a single variable?
body: <p>Here is the file (test.php) than I try to run on my localhost. Javascript works and it creates the text boxes. PHP-part does not work and makes problem.</p>
  
  <pre><code>    &lt;html&gt;
      &lt;head&gt;
      &lt;title&gt;Test&lt;/title&gt;
  
       &lt;script&gt;
  
       function newCheckbox() {
      var aLabel = document.form1.getElementsByTagName('label');
      var last = aLabel[aLabel.length-1];
      var label = document.createElement('label');
      label.appendChild(Box(aLabel.length));
  
      label.appendChild(document.createTextNode('     '+document.getElemenById('text').value));       
      last.parentNode.insertBefore(label, last);
       document.getElementById('text').value = '';
       }
  
  function Box(num) {
  var elm = null;
   try {
       elm=document.createElement('&lt;input type="checkbox" class="chk"&gt;');
      }
    catch(e) {
       elm = document.createElement('input');
      elm.setAttribute('type', 'checkbox');
      elm.className='chk';
     }
      return elm;
      }
  
      function delBoxes(){ 
      var texts = document.form1.getElementsByTagName('label');
      var chbox = document.form1.getElementsByClassName('chk');
      for(var i = 0; i&lt;texts.length-1; i++){
      if(chbox[i].checked){
         chbox[i].parentNode.removeChild(chbox[i]);
         texts[i].parentNode.removeChild(texts[i]);
          }
       }
    }
    &lt;/script&gt;
  
     &lt;?php
  
     $text_0= $_POST['text[0]'];
     echo $text_0;
  
   $textboxes = array();    
   for($i = 0;$i&lt;count($_POST['text[]']); $i++)
  
     {
  
        $textboxes = $_POST['text'][$i];
  
      }
  
  
         $data=$textboxes
  
      ?&gt;
    &lt;/head&gt;
    &lt;body&gt;
  
      &lt;form action="test.php" name="form1" method="post"&gt;
       &lt;div&gt;
        &lt;label&gt;Checkbox text:&lt;input type="text" name="text[]"&gt;&lt;/label&gt;&lt;br&gt;
      &lt;input type="button" onclick="newCheckbox();"value="add"&gt;
      &lt;input type="button" value="Delete" onclick = "delBoxes();" /&gt;
  
      &lt;/div&gt;
      &lt;/form&gt;
  
      &lt;/body&gt;
     &lt;/html&gt;
  </code></pre>
  
  <p>When I run the code I have the following problem
  Undefined index: text[0]
  Undefined index: text[] </p>
  
  <p>I appreciates your help.</p>