RsConcepts Posted September 12, 2014 Share Posted September 12, 2014 I used search function, could not find a subject that addressed my need. I hope I am not repeating a well answered question. I have two MySql fields I want to hyperlink, but not as text links, but with an image. Here is truncated code, if more deatail is need, I can post. Both links work fine now, but show the person's email name and google map link text - looks unproffessional and I think the email links may be able to be harvested by spammers. The E-mail link: echo "<td><a href=mailto:".$row['email'] . ">" .$row['email'] . "</a></td>"; The Google map link: echo "<td><a target='_blank' href=".$row['location_map_link'] . ">" .$row['location_map_link'] . "</a></td>"; Can we use images in this code? I am not a PHP coder!! Ron Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted September 12, 2014 Share Posted September 12, 2014 (edited) Can we use images in this code? It's difficult to tell what exactly you need to do, but you can use an image as the link. You just need to wrap the <a> tag around an <img> tag. For an example, scroll down to Example 2 here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img Edited September 12, 2014 by cyberRobot Quote Link to comment Share on other sites More sharing options...
RsConcepts Posted September 12, 2014 Author Share Posted September 12, 2014 What I am having a difficult time with is wrapping my head aroiund how i would reference an image inside the code I referenced here. My problem is lack of skill in php/mysql. So I want to know if the following links can be editied to be image links, not text. So, the question is, can I use images intead of text in these two pieces of code? I worked them myself to get text links, but I cannot get images referenced in them, everything I do crashes the code and I get a blank page. The E-mail link: echo "<td><a href=mailto:".$row['email'] . ">" .$row['email'] . "</a></td>"; <------- Put an image reference in here instead of text!! The Google map link: echo "<td><a target='_blank' href=".$row['location_map_link'] . ">" .$row['location_map_link'] . "</a></td>"; <------- Put an image reference in here instead of text!! Thanks!! Ron Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted September 12, 2014 Share Posted September 12, 2014 I worked them myself to get text links, but I cannot get images referenced in them, everything I do crashes the code and I get a blank page. Could you post the code that you've tried? Perhaps we can help fix this issue. When posting the code, please surround it with tags. It will make your post and code easier to follow. Quote Link to comment Share on other sites More sharing options...
jcbones Posted September 12, 2014 Share Posted September 12, 2014 You can create an anchor on an image, but you cannot put an image as the reference in an anchor. You could eliminate the mail anchor, and instead handle that server side with PHPMailer. The reason I suggest this is that even if you change the output, the source will always have the email address, and the source is what is scraped. 1 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.