I am trying to make php display the images as links however I cannot make the same images work as links. I want to have the images clickable so they can be opened to their full size.
small images:
echo '<img src="'.$num.'" width=200 hight = 200 alt="random image">'." ";
I want to make them linked to their full image size, I am trying the below but in vain:
echo '<a href="'.$num.'"<img src="'.$num.'" width=200 hight = 200 alt="random image">'." ";
Kindly assist
Your img
tag isn't surrounded by your a
tag properly. As long as $num
is a valid URL, try
echo '<a href="'.$num.'"><img src="'.$num.'" width="200" height="200" alt="random image"></a> ';
The HTML code you want to obtain:
<a href="***"><img src="***" width="200" height="200" alt="***"></a>
with
>
at the end of opening a
, </a>
In PHP:
echo '<a href="'.$num.'"><img src="'.$num.'" width="200" height="200" alt="***"></a>';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.