I have an xpath query that returns the description of a td (with a width of 60) from a table row. I pull between 0 and 30 rows per query.
$textTags = $xpath->query( '//table/tr/td[@width=60]' );
each table row looks like this
<tr>
<td width=60 bgcolor='#ffffcc'><b>Description</b></td>
<td align=center width=80><img src='http://></td>
<td width=50 bgcolor='#ffffcc' align=center><b>1</b></td>
<td bgcolor='#ffffcc'><b>Toy</b></td>
<input type='hidden' name='obj_id_3' value='20885'><input type='hidden' name='oldcost_3' value='0'></td>
<td align=center bgcolor='#ffffcc'><input type='text' name='cost_3' size=6 maxlength=5 value='0'></td>
<td width=180 bgcolor='#ffffcc'><i>more text</i></td>
<td width=40 bgcolor='#ffffcc' align=center><select name=back_to_inv[20885]>
<tr>this continues on a max of 30 times</tr>
I run through a loop to get this info:
foreach ( $textTags as $tag ){
$item = $tag->nodeValue;
}
I get the description text I need. However, there is the 'hidden' input type with a name=obj_id_3
and a value=20885
that I need to get with each corresponding pass. How do I get those hidden input values in addition, that are part of the current tr I'm looking at? Each tr has only 1 record that I need to access so I don't have to worry about multiple, the table you see above is how every table looks, minus the unique description and hidden name and values.
You can just use an or to query the input separately. Something like
$xpath->query("//table/tr/td[@width=60]|//table/tr/input[contains(@id, 'obj_id')]");