Jump to content


Photo

Html and php for images


  • Please log in to reply
7 replies to this topic

#1 valentin

valentin
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 15 July 2006 - 08:02 AM

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

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!

#2 BillyBoB

BillyBoB
  • Members
  • PipPipPip
  • Advanced Member
  • 630 posts

Posted 15 July 2006 - 08:06 AM

use like

echo("<img src=\"imageurl.ext\" />");

try this instead of putting it into a varible

#3 scheols

scheols
  • Members
  • PipPipPip
  • Advanced Member
  • 113 posts

Posted 15 July 2006 - 08:18 AM

^wrong
<?php
$a="<img src=\'image.jpeg\'>";
echo "$a";
?>

dude dont use doible quotes on double quotes if out side quotes are single quotes inside quotes will be double and vice versa
Dont Piss me Off today

#4 BillyBoB

BillyBoB
  • Members
  • PipPipPip
  • Advanced Member
  • 630 posts

Posted 15 July 2006 - 08:30 AM

wtf dude i do that all the time its all good thats the point of using \ slashes duh....

#5 scheols

scheols
  • Members
  • PipPipPip
  • Advanced Member
  • 113 posts

Posted 15 July 2006 - 08:38 AM

and you got the / for?
Dont Piss me Off today

#6 akitchin

akitchin
  • Staff Alumni
  • Advanced Member
  • 2,516 posts
  • LocationCalgary, AB, Canada

Posted 15 July 2006 - 08:51 AM

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:

echo $a;

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

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

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

#7 valentin

valentin
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 15 July 2006 - 09:20 AM

Yes, my problem has been solved! I thank you all for your replies and pacience!

#8 GingerRobot

GingerRobot
  • Staff Alumni
  • Advanced Member
  • 4,086 posts
  • LocationUK

Posted 15 July 2006 - 09:34 AM

Indeed, you do not need to escape quotes if the ones inside the string are different from those containing the string.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users