0

The HTML values from within the TR are:

<input type="radio" name="question_id[1111]" id="question_id[1111]" value="999" class="noborder" checked />Yes</div><div style="white-space:nowrap;margin-right:20px;display:inline-block;">

<input type="radio" name="question_id[1111]" id="question_id[1111]" value="888" class="noborder" />No</div>

My code is:

    $html = str_get_html($results);

    foreach($html->find('tr') as $tr)   
    {               
       foreach($tr->find('input') as $input)
       {   
          if ('not sure what to put here' == 'checked')
          {
           print $input->'value';  
          }                                 
       }
    }

I simply want to determine which of the results contain 'checked.' If it does, it should return 'value.' I am able to obtain the value of value using $input->'value' but how can I get a value of the non-element?

1 Answer 1

1

Not tested but maybe you should try this:

$html = str_get_html($results);

foreach($html->find('tr') as $tr)   
{               
   foreach($tr->find('input[checked]') as $input)
   {   
       print $input->'value';                             
   }
}
Sign up to request clarification or add additional context in comments.

1 Comment

Perfect. Solved the problem and uses less code. thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.