thriller372 Posted February 27, 2015 Share Posted February 27, 2015 Hi,I have an image url stored in a database, I can display the image no problem using this code: echo '<td><img src="'.$row['thumb'].'"></td>'; I am trying to use a variable as a link when you click on the image, as so: <a href='showthumb.php?thumb=$clientthumb'></a> I can use the image as a link but the $clienthumb variable does not show the value of the variable, for example: I get the image with a link of showthumb.php?thumb=$clientthumb but I need The image with a link of showthumb.php?thumb=1 (the number one is $clientthumb value) echo '<td><img src="'.$row['thumb'].'"></td>'; <a href='showthumb.php?thumb=$clientthumb'></a> Quote Link to comment Share on other sites More sharing options...
Solution Barand Posted February 27, 2015 Solution Share Posted February 27, 2015 You need to put the string inside double quotes to expand variable values echo "<td><a href='showthumb.php?thumb=$clientthumb'><img src='{$row['thumb']}' /></a></td>"; see http://php.net/manual/en/language.types.string.php Quote Link to comment Share on other sites More sharing options...
thriller372 Posted February 27, 2015 Author Share Posted February 27, 2015 Fantastic and so simple works a treat, I'd spent nearly two days on this (I like to try and work it out for myself) and got nowhere.You lot make it all seem so simple Cheers Quote Link to comment 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.