olamsco2510 Posted October 9, 2014 Share Posted October 9, 2014 images not displaying on localhost and all the images are in the right directory<?php$kitten_image =0;$church_image=1;If($kitten_image==1) {Print ("<IMG SRC=image/kitten.jpg>");} else { print ("<IMG SRC=image/church.jpg>");}?> Link to comment Share on other sites More sharing options...
niche Posted October 9, 2014 Share Posted October 9, 2014 (edited) 1. make sure the file is there. 2. make sure the filename is exact including upper and lower case. also, "<IMG SRC=image/kitten.jpg>" may need to be "<IMG SRC="image/kitten.jpg">" Edited October 9, 2014 by niche Link to comment Share on other sites More sharing options...
dsonesuk Posted October 9, 2014 Share Posted October 9, 2014 (edited) Use echo instead, and if you use same double quotes within text string you should escape them with print ("<img src="image/kitten.jpg">");print ("<img src="image/church.jpg">"); using echo echo "<img src="image/kitten.jpg">";echo "<img src="image/church.jpg">"; My preferred way without need of escaping echo '<img src="image/kitten.jpg">';echo '<img src="image/church.jpg">'; Edited October 9, 2014 by dsonesuk Link to comment Share on other sites More sharing options...
justsomeguy Posted October 9, 2014 Share Posted October 9, 2014 That opening quote is one character too soon. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now