title: Simple HTML DOM Parser: how to read the value of the selected option
body: <p>I have this HTML piece of code already read into <code>$html</code>. I had extracted some correct information, but I'm stuck getting the selected option value of a <code>select</code>.</p>
  
  <pre><code>&lt;select name="a" id="selstart"&gt;
    &lt;option value="00"&gt;Jan&lt;/option&gt;
    &lt;option value="01"&gt;Feb&lt;/option&gt;
    &lt;option value="02"&gt;Mar&lt;/option&gt;
    &lt;option value="03"&gt;Apr&lt;/option&gt;
    &lt;option value="04"&gt;May&lt;/option&gt;
    &lt;option value="05"&gt;Jun&lt;/option&gt;
    &lt;option selected value="06"&gt;Jul&lt;/option&gt;
    &lt;option value="07"&gt;Aug&lt;/option&gt;
    &lt;option value="08"&gt;Sep&lt;/option&gt;
    &lt;option value="09"&gt;Oct&lt;/option&gt;
    &lt;option value="10"&gt;Nov&lt;/option&gt;
    &lt;option value="11"&gt;Dec&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>and need to extract the value "06" into a variable.</p>
  
  <p>I tried:</p>
  
  <pre><code>foreach($html-&gt;find('select') as $element) {
      if ($element-&gt;id == 'selstart')
      {
          $v =  $element-&gt;find('option selected',0)-&gt;value . '&lt;/br&gt;'; 
      }
  }
  </code></pre>
  
  <p>and many other combinations following the idea found in <a href="https://stackoverflow.com/questions/6484103/php-simple-html-dom-php-get-selected-option">php , simple_html_dom.php, get selected option</a> but did not work.</p>
  
  <p>Any ideas?</p>