title: html form array to JSON
body: <p>I'm having a dynamic html form containing several values, what I need is to add form data to JSON and post it to php page for insertion to mysql.</p>
  
  <p>Form:</p>
  
  <pre><code>&lt;input type="text" name="name[]" id="p" /&gt;
  &lt;input type="text" name="manuf[]" id="k" size="3" /&gt;
  &lt;input type="text" name="item_pr[]" id="ka" size="10" /&gt;
  &lt;input type="text" name="price" id="su" size="10" disabled="disabled"/&gt;&lt;br /&gt;
  </code></pre>
  
  <p>First tried to create JS array but cant figure out how get all values in one code row and how to convert to json and post to php:</p>
  
  <pre><code>var elementai = document.getElementsByName('name[]');
            for (var i = 0, j = elementai.length; i &lt; j; i++) {
            var elementas = elementai[i];
            alert(elementas.value);
            }
  </code></pre>