Jump to content

Html and php for images


valentin

Recommended Posts

I tried to use php with html in order to load an image
[code]<?php
$a="<img src=\"image.jpeg\">";
echo "$a";
?>[/code]

I know that php has its own header for loading an image, but I need a code which uses html. Mine doesn't work, does anyone know if a combination between html and php is possible, in this situation?
Thank you in anticipation!
Link to comment
https://forums.phpfreaks.com/topic/14660-html-and-php-for-images/
Share on other sites

the /> is for elements without a closing tag.  it is XHTML format.

as for the actual issue, why are you using quotes at all?  why not just use:

[code]echo $a;[/code]

furthermore, when setting a string that has no variables, you might as well use single quotes to delimit the expression:

[code]$a = '<img src="imagename.jpg" />';[/code]

if this doesn't solve your issue, you're going to need to be more specific with what you're asking.

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.