title: How to get these values with XPath
body: <p><strong>HTML</strong></p>
  
  <pre><code>&lt;table id='dg' border='0'  class="Table"&gt;
    &lt;tr&gt;
      &lt;td class='text'&gt;id.&lt;/td&gt;
      &lt;td class='text'&gt;file&lt;/td&gt;
      &lt;td class='text'&gt;alt&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class='text'&gt;&lt;input name='somename[]' type='hidden' value='1234'&gt;
        1&lt;/td&gt;
      &lt;td class='text'&gt;&lt;a href='#' onClick="javascript:openPopWindow('../../somefile.jpg');" &gt;&lt;img src='cms_thumb.php?imgsrc=somefile2.jpg' border='0' &gt;&lt;/a&gt;&lt;/td&gt;
      &lt;td class='text'&gt;&lt;input type='text' name='title[]' value='Value 1'&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class='text'&gt;&lt;input name='somename[]2' type='hidden' value='2345'&gt;
        2&lt;/td&gt;
      &lt;td class='text'&gt;&lt;a href='#' onClick="javascript:openPopWindow('../../somefile2.jpg');" &gt;&lt;img src='thumb.php?imgsrc=somefile2.jpg' border='0' &gt;&lt;/a&gt;&lt;/td&gt;
      &lt;td class='text'&gt;&lt;input type='text' name='title[]' value='Value 2'&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p><strong>OBJECTIVE</strong></p>
  
  <p>Need to get img src filename and get value of the input field which have name=title[]</p>
  
  <p><strong>WHAT I HAVE SO FAR</strong></p>
  
  <pre><code>$dom = new DOMDocument;
  $dom-&gt;loadHTML($html);
  $xpath = new DOMXpath($dom);
  
  foreach ($dom-&gt;getElementsByTagName('tr') as $node) { 
      $img = $xpath-&gt;query('//img')-&gt;item(0); 
      $img = str_replace("\'","",$img-&gt;getAttribute('src'));
      $img = str_replace("cms_thumb.php?imgsrc=","",$img);
      echo $img.'&lt;br&gt;';
  }
  </code></pre>
  
  <p>$img contains just first image and not other</p>