I would like to scan a specific select tag for all the option-tags values and content in PHP. So that from this
<select>
<option value="donald">duck</option>
<option value="david">moose</option>
</select>
<select id="something"> <!--ignore this one -->
<option value="sdfas">fs</option> <!-- ignore this one -->
...
I would get something like this:
$result['value'][0] == "donald"
$result['content'][1] == "moose"
And for that I tried:
<select>(?:[\s]*<option value="(?P<value>[^"]*)">
(?P<content>[^<]*)</option>)*[\s]*</select>
But I only get a single row (the last one) with the following code:
preg_match_all('%<select>(?:[\s]*<option value="(?P<value>[^"]*)">
(?P<content>[^<]*)</option>)*[\s]*</select>%',
$contents, $result, PREG_SET_ORDER);
How should I proceed?