title: Javascript Dynamic HTML Inputs to POST via PHP (Need to rename field's per added input)
body: <p>I've seen a few questions that were similar but not specific enough. This one - <a href="https://stackoverflow.com/questions/312605/submit-form-input-fields-added-with-javascript">Submit form input fields added with javascript</a> - is the closest comparison, but it is overwhelming for me (not really a javascript guy).</p>
  
  <p>I'm trying to have dynamically added inputs which post independently on the next page via PHP. My code is as follows (which I found off google).</p>
  
  <p><strong>FORM PAGE</strong></p>
  
  <pre><code>&lt;script language="javascript"&gt;
  fields = 0;
  function addInput() {
  if (fields != 19) {
  document.getElementById('text').innerHTML += "&lt;li&gt;Link Title:&lt;br /&gt;&lt;input type='text' name='title' /&gt;&lt;br /&gt;Link Address:&lt;br /&gt;&lt;input type='text' name='name' /&gt;&lt;br /&gt;Description:&lt;br /&gt;&lt;input type='text' name='copy' /&gt;&lt;/li&gt;";
  fields += 1;
  } else {
  document.getElementById('text').innerHTML += "&lt;br /&gt;Only 20 data entries allowed.";
  document.form.add.disabled=true;
  }
  }
  &lt;/script&gt;
  
  &lt;form name="form" action="form.php" method="post"&gt;
  &lt;ul class="form"&gt;
  &lt;li&gt;
  Link Title:&lt;br /&gt;&lt;input type="text" name="title" /&gt;&lt;br /&gt;
  Link Address:&lt;br /&gt;&lt;input type="text" name="name" /&gt;&lt;br /&gt;
  Description:&lt;br /&gt;&lt;input type="text" name="copy" /&gt;
  &lt;/li&gt;
  &lt;div id="text"&gt;
  
  &lt;/div&gt;
  &lt;/ul&gt;
  &lt;input type="button" onclick="addInput()" name="add" value="Add input field" /&gt; &lt;input type="submit" value="Submit" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>POST PAGE</strong> - Wasn't sure where to begin since all of the fields are using the name 'title'? - I'll be okay with this page though.</p>
  
  <pre><code>&lt;?php
  
      echo $_POST['title'];
  
  ?&gt;
  </code></pre>