title: Problems with form with dynamic number fields
body: <p>I have this form with some dynamic fields called num_entradas.</p>
  
  <p>If you add some numeric values onchange calculates the sum of all the fields with the function sumarTotalEntradas():</p>
  
  <p>All of these works fine, but the problem is when I submit the form to a PHP page I only get the last field value. If I change the name attribute of the fields to num_entradas[] the submit is ok but then the sumaTotalEntradas() function doesn't work and totalEntradas fields remains in 0.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function sumarTotalEntradas() {
    var arr = document.getElementsByName('num_entradas');
    var tot = 0;
    var subtotal = 0;
    for (var i = 0; i &lt; arr.length; i++) { 
      if (parseInt(arr[i].value))
        tot = tot + subtotal;
    }
    document.getElementById('totalEntradas').value = tot;
  
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form&gt;
    &lt;input type="number" min="0" step="1" maxlength="2" name="num_entradas" id="num_entradas" value="0" onchange="sumarTotalEntradas()"&gt;
    &lt;input type="number" min="0" step="1" maxlength="2" name="num_entradas" id="num_entradas" value="0" onchange="sumarTotalEntradas()"&gt;
    &lt;input type="number" min="0" step="1" maxlength="2" name="num_entradas" id="num_entradas" value="0" onchange="sumarTotalEntradas()"&gt;
    Total: &lt;input type="text" maxlength="2" name="totalEntradas" id="totalEntradas" value="0"&gt; €
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>