chris86 Posted September 7, 2006 Share Posted September 7, 2006 I'm trying to add an image (via HTML) to a PHP page. I get a syntax error when I insert the following HTML code into the PHP page. Below is the HTML code I inserted. [code]<img src="http://www.domain.com/uploads/Image/flags.jpg" alt="description of image"> </img>[/code]What am I doing wrong? Why the syntax error? Quote Link to comment https://forums.phpfreaks.com/topic/20036-syntax-error-adding-html-to-php-page/ Share on other sites More sharing options...
HuggieBear Posted September 7, 2006 Share Posted September 7, 2006 Get rid of the </img> tag...Try:[code]<img src="http://www.domain.com/uploads/Image/flags.jpg" alt="description of image" />[/code]RegardsRich Quote Link to comment https://forums.phpfreaks.com/topic/20036-syntax-error-adding-html-to-php-page/#findComment-87889 Share on other sites More sharing options...
chris86 Posted September 7, 2006 Author Share Posted September 7, 2006 Thanks. I killed the </img> tag, and inserted the code you suggested. Unfortunately, I'm still getting a syntax error on line 2. Looks like PHP doesn't like the "<" sign. Error message reads... syntax error, unexpected '<' So, I deleted the <> tags and now I'm getting a syntax error that reads, "unexpected T_STRING". Any other suggestions? I'm just trying to add an image. Quote Link to comment https://forums.phpfreaks.com/topic/20036-syntax-error-adding-html-to-php-page/#findComment-87896 Share on other sites More sharing options...
HuggieBear Posted September 7, 2006 Share Posted September 7, 2006 Oh, if you're print from the php, you need to escape the quotes... try this:[code=php:0]<?php echo "<img src=\"http://www.domain.com/uploads/Image/flags.jpg\" alt=\"description of image\">";?>[/code]If that doesn't work, post the code you have.RegardsRich Quote Link to comment https://forums.phpfreaks.com/topic/20036-syntax-error-adding-html-to-php-page/#findComment-87899 Share on other sites More sharing options...
chris86 Posted September 7, 2006 Author Share Posted September 7, 2006 That worked! Fantastic, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/20036-syntax-error-adding-html-to-php-page/#findComment-87903 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.