title: Dynamically created form elements value not getting in $_POST in php
body: <p>I have created some dynamic text boxes and values according to the no. of cart items selected by a user. The no. of cart items are stored in a cookie and I am trying to do the following:</p>
  
  <p>1) Get the no. of cart items from the cookie named <code>cartcounter</code> <br />
  2) Create 'cartcounter' no of text boxes with name <code>itemkey_skey</code> where <code>itemkey</code> is the hash key of each items in user cart. <br />
  3) Submit the form <br />
  4) Get the keys of the selected items in php</p>
  
  <p>Now I can create <code>cartcounter</code>, the number of text boxes with different values. </p>
  
  <p>But the problem is that I can get only the first text box value in $_POST in PHP. I would like to get all the values of the dynamically created form elements.</p>
  
  <p>Code:</p>
  
  <pre><code>$(document).ready(function() {
      if (getCookie("cartcounter") != 0) {
          $("#counter").val(getCookie("cartcounter"));
          for (var i = 1; i &lt;= cartcounter; i++) {
  
              var ckey = getCookie(i + "_skey");
              var element = document.createElement("input");
              alert("Element=" + element);
              element.setAttribute("type", "text");
              element.setAttribute("value", ckey);
              element.setAttribute("name", "skey_" + ckey);
              var foo = document.getElementById("itmbox");
              foo.appendChild(element);
              $("#frm").submit();
          }
      }
      else {
          alert('Your cart is empty , please choose your product');
          window.location = "http://synergiadigital.com/restaurant2/orderFood.php/"
      }
  });​
  </code></pre>