Page 1 of 1

php xml

Posted: Tue Sep 08, 2009 8:43 pm
by RustyDoorknobs
I'm trying to get the value of an src attribute for an img element by getting the element using its id. I keep getting:


Fatal error: Call to undefined function getelementbyid() in /home/myavatar/public_html/getteamlogo.php on line 9

When i try it.

Heres my code:

Code: Select all

<?php
 
//Load in user profile
$u = $_GET["u"];
$p = new DOMDocument();
$p->validateOnParse = true;
@$p->load( $u );
$logo_id="team-logo";
$logo_element = getElementById($logo_id);
$logo = $logo_element->getAttribute("src");
//Make in html...
$html_output = '<img src="' . $logo . '"' . 'id="logo" />';
//Final output:
echo $html_output;
 
?>

Re: php xml

Posted: Wed Sep 09, 2009 3:32 pm
by RustyDoorknobs
i tried that and now i get

Parse error: syntax error, unexpected T_VARIABLE in /home/myavatar/public_html/getteamlogo.php on line 10


And heres my code:

<?php

//Load in user profile
$u = $_GET["u"];
$p = new DOMDocument();
$p->validateOnParse = true;
@$p->load( $u );
$logo_id="team-logo";
$logo_element = $p->getElementById($logo_id)
$logo = $logo_element->getAttribute("src");
//Make in html...
$html_output = '<img src="' . $logo . '"' . 'id="logo" />';
//Final output:
echo $html_output;

?>