Greetings guys and gals
I’m quite new to PHP and need a little help.
I have a form that when an appropriate ID is entered, then grabs some info from a webpage and displays it. What I need is for that info to be displayed in a textarea below the form.
The form:
[code]
Enter the album ID:
<div id="output">
<!-- I need the output of the PHP script to display in the textarea below: -->
<textarea></textarea>
</div>[/code]
The PHP code:
[php]require_once(‘simple_html_dom.php’);
if (empty($_POST[“album_id”])){
print “Whoops, you left the field empty!”;
}
else
{
// Create DOM from URL
$html = file_get_html(‘http://vgmdb.net/album/’.$_POST[“album_id”]);
$url = (‘http://vgmdb.net’);
// Grab the tracklist
foreach($html->find('div#tracklist') as $element)
echo $element;
} [/php]
I tried this:
<textarea><?php echo $element; ?></textarea>
… but it obviously loads this on the ‘test.php’ page. Is it possible to dump the output of the PHP script straight into the text area below the form?