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. 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. 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. 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/ 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
Archived
This topic is now archived and is closed to further replies.