Ministério Público wrote:
Here it goes: in a certain page there is a dinamicaly generated Option ( one of those boxes from wich you can select a certain thing in a list) I want to retrieve the content of these options and the values assigned to each of them.

So if you have:

<option value="test1">Test 1</option>
<option value="test2">Test 2</option>

You want:

$test1 = "Test 1";
$test2 = "Test 2";

??

preg_match_all('%<option value=["\']*([^"\'>]+?)["\']*\s*>(.*)</option>%isU', $text, $matches);

That will give you an array that looks like this:

Array
(
    [0] => Array
        (
            [0] => <option value="test1">Test 1</option>
            [1] => <option value="test2">Test 2</option>
        )

    [1] => Array
        (
            [0] => test1
            [1] => test2
        )

    [2] => Array
        (
            [0] => Test 1
            [1] => Test 2
        )

)

From there you should be able to work out what to do..

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to