image.html –
<img src="showImage.php?id=44"/> <– this is the code I’m trying to make work.
showImage.php –
<?php echo ("showImage.php called"); ?> <– this is the php file I’m trying to call.
The problem is.. img tag is not calling ‘showImage.php’ to print out “showImage.php called.”. Instead, it tries to display showImage.php file as an image 🙁 … and doesn’t display what it’s supposed to. Am I doing something wrong here?
*Note: id=44 will be used for something else… not a big concern here.
Thank you.
If you actually visit that page in the browser, I’m sure it will print out
showImage.php calledin the browser. However, you’re specifying that the file should be an image in your HTML and the browser is trying to treat it as an image. When it gets a text/html file instead, the browser merely shows that the image was invalid, it does not print the text instead. Your showImage.php will need to actually output an image in order for the browser to render it inside your document. Otherwise, you’ll have to visit the page manually to see any text it’s outputting for debugging, etc.All in all, it is calling your file, the browser is just ignoring the result. It will never show text instead of an image, unless you specify an
altattribute.