title: Posting HTML form data to php (Debug)
body: <p>I have a simple form created, which allows the users to add and delete rows as they choose.  After the user decides how many rows to add and populates the form accordingly, after submitting, I'd like to post the data so that I can use a .php script to upload the data onto a server. </p>
  
  <p>I have tested the functionality of adding and deleting rows.  When I click the submit button, it redirects me to upload.php, but at that page, I see an error: "Undefined index: reward" which makes me think that the data isn't being sent properly.</p>
  
  <p>Is there a problem with my implementation below?</p>
  
  <p>HTML
      
      </p>
  
  <pre><code>&lt;button onclick="addRow();"&gt;Add Row&lt;/button&gt;
  &lt;form method="post" action="upload.php"&gt;
      &lt;table border="1" id="optionsTable"&gt;
          &lt;tr&gt;
          &lt;td&gt;Header1&lt;/td&gt;
          &lt;td&gt;Header2&lt;/td&gt;
          &lt;td&gt;Delete&lt;/td&gt;
          &lt;/tr&gt;
  
          &lt;tr id="templateRow" style="display:none"&gt;
          &lt;td&gt;&lt;input type="text" id="reward" /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type="text" id="duration" /&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="button" id="deleteOption" value="Delete"     onclick="delRow(this)"/&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  
      &lt;input type="submit" value="Submit" /&gt;
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  
  &lt;script&gt;
  var maxID = 0;
  function getTemplateRow() {
      var x = document.getElementById("templateRow").cloneNode(true);
      x.id = "";
      x.style.display = "";
      x.innerHTML = x.innerHTML.replace(/{id}/, ++maxID);
      return x;
  }
  function addRow() {
      var t = document.getElementById("optionsTable");
      var rows = t.getElementsByTagName("tr");
      var r = rows[rows.length - 1];
      r.parentNode.insertBefore(getTemplateRow(), r);
  }
  function delRow(row) {
      var i=row.parentNode.parentNode.rowIndex;
      document.getElementById('optionsTable').deleteRow(i);
  }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>I'm only debugging with upload.php right now so there is only one command there:
      echo($_POST['reward']);</p>
  
  <p>Any help would be greatly appreciated.</p>