php xml

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
RustyDoorknobs
Forum Newbie
Posts: 15
Joined: Mon Sep 07, 2009 4:50 pm

php xml

Post 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;
 
?>
RustyDoorknobs
Forum Newbie
Posts: 15
Joined: Mon Sep 07, 2009 4:50 pm

Re: php xml

Post 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;

?>
Post Reply