valentin Posted July 15, 2006 Share Posted July 15, 2006 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 More sharing options...
BillyBoB Posted July 15, 2006 Share Posted July 15, 2006 use like echo("<img src=\"imageurl.ext\" />"); try this instead of putting it into a varible Link to comment https://forums.phpfreaks.com/topic/14660-html-and-php-for-images/#findComment-58430 Share on other sites More sharing options...
scheols Posted July 15, 2006 Share Posted July 15, 2006 ^wrong[code]<?php$a="<img src=\'image.jpeg\'>";echo "$a";?>[/code]dude dont use doible quotes on double quotes if out side quotes are single quotes inside quotes will be double and vice versa Link to comment https://forums.phpfreaks.com/topic/14660-html-and-php-for-images/#findComment-58432 Share on other sites More sharing options...
BillyBoB Posted July 15, 2006 Share Posted July 15, 2006 wtf dude i do that all the time its all good thats the point of using \ slashes duh.... Link to comment https://forums.phpfreaks.com/topic/14660-html-and-php-for-images/#findComment-58433 Share on other sites More sharing options...
scheols Posted July 15, 2006 Share Posted July 15, 2006 and you got the / for? Link to comment https://forums.phpfreaks.com/topic/14660-html-and-php-for-images/#findComment-58435 Share on other sites More sharing options...
akitchin Posted July 15, 2006 Share Posted July 15, 2006 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. Link to comment https://forums.phpfreaks.com/topic/14660-html-and-php-for-images/#findComment-58436 Share on other sites More sharing options...
valentin Posted July 15, 2006 Author Share Posted July 15, 2006 Yes, my problem has been solved! I thank you all for your replies and pacience! Link to comment https://forums.phpfreaks.com/topic/14660-html-and-php-for-images/#findComment-58444 Share on other sites More sharing options...
GingerRobot Posted July 15, 2006 Share Posted July 15, 2006 Indeed, you do not need to escape quotes if the ones inside the string are different from those containing the string. Link to comment https://forums.phpfreaks.com/topic/14660-html-and-php-for-images/#findComment-58447 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.