How do I extract specific data with preg_match?
- by paulswansea
I'm looking to extract values from a whole load of html (i've just trimmed down to the relevant data), there are multiple 'select' elements, and only want to extract those who's 'name' element matches the name 'aMembers'. So the resulting values I would like to retrieve are 5,10,25 and 30 (see below) how can I achieve this with preg_match?
<DIV id="searchM" class="search"><select name="aMembers" id="aMembers" tabIndex="2">
<option selected="selected" value="">Data 3</option>
<option value="5">A name</option>
<option value="10">Another name</option>
</select>
</DIV>
<DIV id="searchM" class="search"><select name="bMembers" id="bMembers" tabIndex="2">
<option selected="selected" value="">Data 2</option>
<option value="15">A name</option>
<option value="20">Another name</option>
</select>
</DIV>
<DIV id="searchM" class="search"><select name="aMembers" id="Members" tabIndex="2">
<option selected="selected" value="">Data 1</option>
<option value="25">A name</option>
<option value="30">Another name</option>
</select>
</DIV>