views:

45

answers:

1

how can i get value from field textarea. i want to detail- i need to parse html page and get value from field textarea not call something like $_POST["textarea"]

+1  A: 

Option 1

Best way for parsing like this is to use DOM, http://www.php.net/manual/en/book.dom.php After you load your page into the DOM, you can use getElementById('textarea_id'), php docs are here. If your text area has ID or getElementsByTagName('textarea'), but in this case you will get NodeList. So it will look something like this:

// dom
$nodes = $dom->getElementsByTagName('textarea');
$node1 = $nodes->item(0);



Option 2

Another option is to get the page as string and use regular expression to match your textbox and get info out of it. I found this class in google, it is HTML Form Parser - http://www.alexandruion.com/html-form-parser

Alex
+1 for DOM parser, -1 for suggesting regex to parse HTML.
webbiedave