Jump to content

Cannot get my image to work with a PHP script. Need Help!


dennissanche

Recommended Posts

I will try to make this a clear as possible.

 

I am trying to insert an image into a piece of php code in dreamweaver but and only getting )?;> instead of the image.

 

I start with this code: <?php print getOffer(0, '<img src="image.png" alt="my image" />'); ?>

 

the image.png is where i would insert my own image file.

when i do this however i get this ')?;>

 

I have attached a screenshot of the code in dreamweaver

I know its probably a simple mistake I am making but I cannot for the life of me figure out what it is.

Any insight is appreciated

 

 

[attachment deleted by admin]

you can always try switching the ' and " around.

<?php print getOffer(0, "<img src='image.png' alt='my image' />"); ?>

 

if that doesn't work you can always try it without the '.

<?php print getOffer(0, <img src="image.png" alt="my image" />); ?>

 

other than those I wouldn't really know what the problem is.

If you're seeing the ")'?>" being output, that means that the PHP processor is not being activated for your code. What is happening is that the browser is seeing the "<" as an opening of an HTML tag and is eating everything until the first ">" and then outputing everything else.

 

Is your file's extension ".php" or ".html". It must be ".php" (unless .html files are processed by PHP, which is not likely).

 

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.