使用PHP从每个TR获取第二个TD的值

I have a this table and I need to get the value of the second TD in a table row. Can I do this with PHP, and how can it be done?

This is my table:

<table class = "jshop cart">
  <tr class = "jshop_prod_cart odd">
    <td class = "jshop_img_description_center">
      <a href = "/shopping/index.php/product/view/210/3690">
        <img src = "http://localhost/shopping/components/com_jshopping/files/img_products/noimage.gif" alt = "test" class = "jshop_img" />
      </a>
    </td>
    <td style="text-align:left">
        FIRST VALUE I NEED                      
            </td>    
    <td>
        1 ден.            </td>
    <td>
      <input type = "text" name = "quantity[0]" value = "1" class = "inputbox" style = "width: 25px" />
    </td>
    <td>
        1 ден.            </td>
    <td>
      <a href = "/shopping/index.php/cart/delete?number_id=0" onclick="return confirm('Навистина сакате да го отстраните?')"><img src = "http://localhost/shopping/components/com_jshopping/images/remove.png" alt = "Отстрани" title = "Отстрани" /></a>
    </td>
  </tr>

  <tr class = "jshop_prod_cart even">
    <td class = "jshop_img_description_center">
      <a href = "/shopping/index.php/product/view/169/2876">
        <img src = "http://localhost/shopping/components/com_jshopping/files/img_products/thumb_3e28bb073e2ac2ca90345955ead6fc58.JPG" alt = "" class = "jshop_img" />
      </a>
    </td>
    <td style="text-align:left">
                 SECOND VALUE I NEED       

            </td>    
    <td>
        140 ден.            </td>
    <td>
      <input type = "text" name = "quantity[1]" value = "1" class = "inputbox" style = "width: 25px" />
    </td>
    <td>
        140 ден.            </td>
    <td>
      <a href = "/shopping/index.php/cart/delete?number_id=1" onclick="return confirm('Навистина сакате да го отстраните?')"><img src = "http://localhost/shopping/components/com_jshopping/images/remove.png" alt = "Отстрани" title = "Отстрани" /></a>
    </td>
  </tr>
    </table>

You can use a DOM parser such as Simple HTML DOM Parser like this:

$ret = $html->find('td', 2);

PHP wouldn't be used for this scenario as it is a server-side language. PHP operates on the server and not the client. Unless you are willing to send the whole page's data to PHP through Javascript, I see no reason to use PHP to select those values. I would think that you should use jQuery to extract those values. jQuery has tons of ways to do stuff like this. Do a basic google search.

If you have the table during the PHP processing, you can use XPath on it. Something like this: (consider this psuedo code, typed without testing)

$xpath = new DOMXPath($doc);
$values= $xpath->query("/table/tr/td[2]");

foreach ($values as $value)
{
    echo $value->nodeValue;
}

Just a thought, you can use jquery. Assign an id to the element, you can have a hidden input.

in html, something like this:

<input type="hidden" id="test" value="<?=row['value']?>">

in jquery, you can get the elements value, something like this:

<script>
   $(document).ready(function(){
     $('#button').click(function() {
       $('#sub_cont').fadeIn('fast');
       $("#content #sub_cont").load("postpage.php?id="+ $("#test").val());
     });
  });
</script>