PHP Script for image hover but its not working
<p>I'm not quite sure what is wrong. I've tried a few things but I just can't get it working. When you hover over the link it should have a little image but it won't work. It seems to be outputting the HTML correctly</p>

<pre><code>    &lt;html&gt;
    &lt;head&gt;
    &lt;title&gt;JamieHankins.co.uk&lt;/title&gt;
    &lt;link rel="stylesheet" href="http://jamiehankins.co.uk/css.css"&gt;
    &lt;style type="text/css"&gt;
    table.tables td {
        border-width: 4px;
        padding: 8px;
        border-style: solid;
        border-color: #999999;
    }
    .ddimgtooltip{
    box-shadow: 3px 3px 5px #818181; /*shadow for CSS3 capable browsers.*/
    -webkit-box-shadow: 3px 3px 5px #818181;
    -moz-box-shadow: 3px 3px 5px #818181;
    display:none;
    position:absolute;
    border:1px solid black;
    background:white;
    color: black;
    z-index:2000;
    padding: 4px;
    }
    &lt;/style&gt;
    &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript"&gt;
    var ddimgtooltip={

        tiparray:function(){
            var tooltips=[]
            &lt;?php
            $count = 0;
            if ($handle = opendir('.')) {
            while (false !== ($entry = readdir($handle))) {
            if ($entry != "." &amp;&amp; $entry != "..") {
            $count++;
            echo"
            ";
            echo "tooltips[$count]=['$entry']";
            }
            }
            }
            ?&gt;

            return tooltips
        }(),

        tooltipoffsets: [20, -30],

        tipprefix: 'imgtip',

        createtip:function($, tipid, tipinfo){
            if ($('#'+tipid).length==0){
                return $('&lt;div id="' + tipid + '" class="ddimgtooltip" /&gt;').html(
                    '&lt;div style="text-align:center"&gt;&lt;img src="' + tipinfo[0] + '" /&gt;&lt;/div&gt;'
                    + ((tipinfo[1])? '&lt;div style="text-align:left; margin-top:5px"&gt;'+tipinfo[1]+'&lt;/div&gt;' : '')
                    )
                .css(tipinfo[2] || {})
                .appendTo(document.body)
            }
            return null
        },

        positiontooltip:function($, $tooltip, e){
            var x=e.pageX+this.tooltipoffsets[0], y=e.pageY+this.tooltipoffsets[1]
            var tipw=$tooltip.outerWidth(), tiph=$tooltip.outerHeight(), 
            x=(x+tipw&gt;$(document).scrollLeft()+$(window).width())? x-tipw-(ddimgtooltip.tooltipoffsets[0]*2) : x
            y=(y+tiph&gt;$(document).scrollTop()+$(window).height())? $(document).scrollTop()+$(window).height()-tiph-10 : y
            $tooltip.css({left:x, top:y})
        },

        showbox:function($, $tooltip, e){
            $tooltip.show()
            this.positiontooltip($, $tooltip, e)
        },

        hidebox:function($, $tooltip){
            $tooltip.hide()
        },


        init:function(targetselector){
            jQuery(document).ready(function($){
                var tiparray=ddimgtooltip.tiparray
                var $targets=$(targetselector)
                if ($targets.length==0)
                    return
                var tipids=[]
                $targets.each(function(){
                    var $target=$(this)
                    $target.attr('rel').match(/\[(\d+)\]/)
                    var tipsuffix=parseInt(RegExp.$1)
                    var tipid=this._tipid=ddimgtooltip.tipprefix+tipsuffix 
                    var $tooltip=ddimgtooltip.createtip($, tipid, tiparray[tipsuffix])
                    $target.mouseenter(function(e){
                        var $tooltip=$("#"+this._tipid)
                        ddimgtooltip.showbox($, $tooltip, e)
                    })
                    $target.mouseleave(function(e){
                        var $tooltip=$("#"+this._tipid)
                        ddimgtooltip.hidebox($, $tooltip)
                    })
                    $target.mousemove(function(e){
                        var $tooltip=$("#"+this._tipid)
                        ddimgtooltip.positiontooltip($, $tooltip, e)
                    })
                    if ($tooltip){
                        $tooltip.mouseenter(function(){
                            ddimgtooltip.hidebox($, $(this))
                        })
                    }
                })

            })
        }
    }

    ddimgtooltip.init("*[rel^=imgtip]")
    &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
    &lt;div class="box"&gt;
    &lt;span class="title"&gt;Screenshot Bin&lt;/span&gt;
    &lt;table class="tables"&gt;
    &lt;tr&gt;
    &lt;?php
    $COUNT = 0;
    if ($handle = opendir('.')) {
    while (false !== ($entry = readdir($handle))) {
        if ($entry != "." &amp;&amp; $entry != ".." &amp;&amp; $COUNT % 3 == 0) {
            echo "&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href='$entry' rel='imgtip[$COUNT]'&gt;$entry&lt;/a&gt;&lt;/td&gt;";
            $COUNT++;
        }
        else {echo "&lt;td&gt;&lt;a href='$entry' rel='imgtip[$COUNT]'&gt;$entry&lt;/a&gt;&lt;/td&gt;";
        $COUNT++;
        }
    }
    closedir($handle);
    }
    ?&gt;
    &lt;/tr&gt;
    &lt;/table&gt;
    &lt;/div&gt;
    &lt;div class="proboxs"&gt;
    &lt;a class="social" href="http://jamiehankins.co.uk/"&gt;Back&lt;/a&gt;
    &lt;/div&gt;
    &lt;/body&gt;
    &lt;/html&gt;
            &lt;/body&gt;
            &lt;/html&gt;
</code></pre>
