Image not displaying in PHP script

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
spec36
Forum Commoner
Posts: 28
Joined: Thu Nov 19, 2009 6:07 pm

Image not displaying in PHP script

Post by spec36 »

Hi Guys,

I have the following link to an image that does not display when I point a <IMG SRC tag to it.

Note: The $BOB is not a variable in my script, but it is a code that is needed in the link to specify what chart to show.

Code: Select all

<?php code here
?>
<html>
<img src="http://website.com/c-sc/sc?r=658974&chart=$BOB:MM.TT,uu[305,a]dacayaci[pb20!b50][dd]">
</html
<?php more code here
?>
For some reason html is unable to read the above as a link and display the image. The link was taken from the address bar for the webpage that displays the image/chart properly. If I copy the link and paste it into firefox it loads the chart correctly. For some reason HTML is not understanding that I want the full thing to be the link to the image.

Is there a way to do this in HTML or PHP to tell the script that I want the full thing to be a web link?

Any help would be greatly appreciated.

Thanks,

Spec36
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: Image not displaying in PHP script

Post by twinedev »

Not sure, but offhand the first thing I would try would be this:

Code: Select all

<?php 
    // code here

    $strImgSrc = 'http://website.com/c-sc/sc?r=658974&chart='.urlencode('$BOB:MM.TT,uu[305,a]dacayaci[pb20!b50][dd]');
 ?>
<html>
<img src="<?php $strImgSrc; ?>">
</html
<?php 
    // more code here
?>
Post Reply