Q:

Adding Table Cell Contents to PHP $_POST

From my understanding, the only way to retrieve $_POST data is using the name attribute of the element, like so:
<INPUT type="text" name="txt">

and the PHP portion:
<?php $text = $_POST["txt"]; ?>

I've got a table with cells containing plain text, for example:
<td class="textField" id="txt1"> Some text </td>

Is there anyway to post the text in these table cells and retrieve them using either the class or id? Maybe there is a clever way to get around this? <td> doesn't have a name attribute thus the reason for my question.
Thanks!

A:

The solution that ended up working for me was to grab the data using jQuery, encode it in JSON, and add it to a serial array of the rest of the form data.
$("#orderForm").submit(function(e) {
    e.preventDefault();

    // Get NON-INPUT table cell data
    var subtotal = new Array();
    $('#priceTable td.subtotal').each(function() {
        subtotal.push($(this).html());
    });

    // Get all INPUT form data and organize as array
    var formData = $(this).serializeArray();

    // Encode with JSON
    var subArray = JSON.stringify(subtotal);

    // Add to formData array
    formData.push({name: 'sub', value: subArray});

    // Submit with AJAX
    $.ajax({
        url: "submitOrder.php",
        data: formData,
        type: 'post',
        success: function(data) {
            alert(data);
        }
    });
});

And on the PHP side:
$subtotals = json_decode($_POST['sub']);

