Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8286879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:53:40+00:00 2026-06-08T11:53:40+00:00

I have an xpath query that returns the description of a td (with a

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T11:53:41+00:00Added an answer on June 8, 2026 at 11:53 am

    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')]");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have xpath page.search(//table[@class='campaign']//table) which returns two tables. I need to choose only first
I have a malformed HTML that I can't change. Running a XPath Query doesn't
I have the following xpath query which seems to be working but I just
I have an XPath engine implementation that needs to be tested. Is there a
I have the following XPATH line: //det[@nItem=1]/prod/cProd That successfully selects the desired node using
I have a problem finding elements in XPath that's contains a certain string ignoring
I have an XML document that includes XPath expressions that I need to use
What XPath query should I use to get to the GetLogisticsOfferDateResult Node? I have
Say I have a table called xml that stores XML files in a single
I have an XML value and an XPath query like this: XML: <Firms> <Firm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.