title: Submitting an HTML table row to php
body: <p>I need help figuring out how to submit data from a table row into PHP to be processed. I would need it to be able to submit multiple rows of data. Any ideas?</p>
  
  <p>I have a table <a href="http://jsfiddle.net/djp122/cp6ne/" rel="nofollow">here</a>. I want to be able to check the row and submit the data to php to process the data. It is an HTML table. I just want to know how to pass the variables to php, e.g. an array or something</p>
  
  <p>Ok guys something like this:</p>
  
  <pre><code>$("submit_btn").click(function () {
  
         $('#diary tbody&gt;tr input:checked').each(function() {
             $.post('process.php', 
                  data: "an array",
                  success: "data submitted");
         }
  
  });
  </code></pre>
  
  <p>How would I get the table row data in an array to submit it? (Answer is below)</p>
  
  <p>Ok Part 2: </p>
  
  <p>Sending the table row data to php. </p>
  
  <p>jQuery code:</p>
  
  <pre><code>    rows = JSON.stringify(rows); // submit this using $.post(...)
      alert(rows);
      $.post('classes/process.php', rows, function(data) {
        $('#results').html(data);
      })
          .error(function() { alert("error"); })
      });
  </code></pre>
  
  <p>PHP Code:</p>
  
  <pre><code>&lt;?php
  
  $rowsArray = json_decode($_POST['rows']);
  
  echo $rowsArray;
  ?&gt;
  </code></pre>
  
  <p>Error: </p>
  
  <pre><code>Notice: Undefined index: rows in C:\...\classes\process.php on line 6
  </code></pre>