Jump to content

Recommended Posts

I cannot figure out how to add this tooltip snippet

 




$tooltips = Array("Prison"=>"This word is word number 1", "Word2"=>"This word is word number 2");

$content = "Here are Word1 and Word2";
foreach ($tooltips as $word=>$tip){
   $content = preg_replace("/(".$word.")/", "<span title='".$tip."'>$1</span>", $content);
}
echo $content;

 

to the following image displayed from a database

 



echo "<img src='".$showimage."' height='200px' width='133px' />";

 

every time I try to call the variable $showimage in the tooltip, it comes out as a bunch of error messages and text. Any help would be greatly appreciated.

Link to comment
https://forums.phpfreaks.com/topic/269979-how-to-add-a-tooltip-to-an-image/
Share on other sites

From your code, I'm not really sure what you're having problems with. Maybe giving us the error messages would help, but I wrote to someone else adding a tooltip to an image with and without JS.

 

http://forums.phpfreaks.com/topic/269966-how-to-add-tooltip-for-image-displayed-from-database/

 

If that's the kind of tooltip you're talking about. It could be changed to fit about anything.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.