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]

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.