I think i don’t get it. I tried to parse some html page :
<select name="sel">
<option value="val0">-please select me-</option>
<option value="val1">some selection</option>
</select>
Im using the Simple_html_dom class :
foreach($html->find('select') as $s) {
if ($html->find('option',1) != false) {
$tempoption = $html->find('option',1)->plaintext;
echo $tempoption; //shows 'some selection'
}
}
but, then if i simply use this line :
$value='';
if ( $tempoption == 'some selection')
$value='79';
echo $value; //doesn't shows anything (empty variable?)
//or this one :
if ( strcmp($tempoption, 'some selection'))
$value='79';
echo $value; //Nope.
I tried out the code just as you had it there and
$valueDID end up with 79. But I think that you must have more to your HTML than that tiny snippet. The thing in your code that stood out most to me was the fact that you are wrapping the conditionals in a loop that goes through all the selects of the HTML, but you are not making use of the individual select elements that you get from the loop, so the foreach loop seems pointless..Have a look at this:
When given HTML:
The output will be: