sildona Posted October 27, 2012 Share Posted October 27, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/269979-how-to-add-a-tooltip-to-an-image/ Share on other sites More sharing options...
jcbones Posted October 27, 2012 Share Posted October 27, 2012 Post the error messages. Quote Link to comment https://forums.phpfreaks.com/topic/269979-how-to-add-a-tooltip-to-an-image/#findComment-1388128 Share on other sites More sharing options...
codefossa Posted October 27, 2012 Share Posted October 27, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/269979-how-to-add-a-tooltip-to-an-image/#findComment-1388132 Share on other sites More sharing options...
Interista Posted October 27, 2012 Share Posted October 27, 2012 I'm using jQuery tooltip , so easy to use : http://onehackoranother.com/projects/jquery/tipsy/ Quote Link to comment https://forums.phpfreaks.com/topic/269979-how-to-add-a-tooltip-to-an-image/#findComment-1388133 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.