Quick question about variables in img tags.

Greetings, first time poster here.
I am currently taking a php course and have an assignment that requires me to print out an image stored in a variable. The images are numbered and the variable is a randomly generated number which corresponds to one of the images in the folder. My problem at the moment is trying to get the image outputted using the image’s path plus the variable containing the image. Here is what I have:

Any help would be awesome and I’ll make sure to repost if I figure it out in time.

Hi there,

Try the following:
echo “<img src=”./images/".$image."" alt="" />";

Thanks, it worked. I was thinking of something around the same from the knowledge of Perl.

Sponsor our Newsletter | Privacy Policy | Terms of Service