Extract Select box with data from HTML

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • niftyhawk@gmail.com

    Extract Select box with data from HTML

    Hi,

    Consider the following html EMBEDDED in a php variable say contents

    <html><body><fo rm name="xyz" method="post" action="xyz.php "><select
    name=ListID><op tion value="T80240"> BOOKSLIST</option><option
    value="T80238"> LIST TEST</option><option value="T80239"> NEW
    TEST</option><option value="T80236"> T80233</option><option
    value="T80237"> T80233</option><option value="T80235"> TEST
    LIST</option><option
    value="T80233"> mylist</option></select></form></body></html>

    How would I use preg_match to retrive all data from <select
    name=ListID> to </select> in one variable ignoring rest of the html?

    Thanks

  • Ian Collins

    #2
    Re: Extract Select box with data from HTML

    niftyhawk@gmail .com wrote:[color=blue]
    > Hi,
    >
    > Consider the following html EMBEDDED in a php variable say contents
    >
    > <html><body><fo rm name="xyz" method="post" action="xyz.php "><select
    > name=ListID><op tion value="T80240"> BOOKSLIST</option><option
    > value="T80238"> LIST TEST</option><option value="T80239"> NEW
    > TEST</option><option value="T80236"> T80233</option><option
    > value="T80237"> T80233</option><option value="T80235"> TEST
    > LIST</option><option
    > value="T80233"> mylist</option></select></form></body></html>
    >
    > How would I use preg_match to retrive all data from <select
    > name=ListID> to </select> in one variable ignoring rest of the html?
    >[/color]
    Why not parse the HTML and use the DOM interface? Maybe not the fastest
    for this example, but easier in the more general case.

    --
    Ian Collins.

    Comment

    Working...