How can I properly fetch id of images with jQuery?
<p>I have 3 php pages and their fuctionality is to showing images that are stored in database and if you double click to one image, the porperties of that image is showed on the screen.</p>

<ul>
<li>update.php</li>
<li>list.php</li>
<li>update_list.php</li>
</ul>

<p><em>"update.php"</em> has 2 select boxes: main category and sub category. If you submit, the <em>"list.php"</em> is showed in <em>"update.php"</em> through jquery load(). It has also same relation with <em>"list.php"</em> and *"update_list.php"*. <em>"list.php"</em> contains images and if you double click one image, the *"update_list.php"* is showed at left part of the screen.</p>

<p>These are codes:</p>

<p>Update.php</p>

<pre><code> &lt;?php
include('../../include/settings.php');
?&gt;

&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="content-type" content="text/html; charset=UTF-8"&gt;
&lt;link rel="stylesheet" type="text/css" href="../../mystyle.css" /&gt;
&lt;script src="../../include/all.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
$(document).ready(function(){

    $("#buttonList").click(function(){
        var main_id=$('#selectMainProList').val();
        var sub_id=$('#selectSubProList').val();
        $('#list').load('list.php?sub_id='+sub_id+'&amp;main_id='+main_id);
        });

    $("#selectMainProList").change(function(){
        var main_cat_id=$('#selectMainProList').val();
        $('#selectSubProList').load('update.html', function(){
            $('#spanSubProList').load('update.php?selected='+main_cat_id+' #selectSubProList');
        });
    });


});
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;?php
    $posted_parent = getGet('selected'); //birbirine bağlı selectboxlar'da main selectbox'ın id'sini tutar.
?&gt;
&lt;form id="formProList" method="POST"&gt;
    &lt;table align="center"&gt;
        &lt;tr&gt;
            &lt;td&gt;Ana Kategoriyi Seçiniz&lt;/td&gt;
            &lt;td&gt;
                &lt;span id="spanMainProList" name="spanMainProList"&gt;
                    &lt;select id="selectMainProList" name="selectMainProList"&gt;
                        &lt;option value="0"&gt;--------------------------&lt;/option&gt;
                        &lt;?
                            $sql="Select * from kategori where ust_kat_id='0'";
                            $result=mysql_query($sql);
                            while($row = mysql_fetch_row($result))
                            {
                                $main_pro_id=$row[0];
                                $main_pro_name=$row[1]; 

                                echo "&lt;option value='".$main_pro_id."'&gt;".$main_pro_name."&lt;/option&gt;";

                            }
                        ?&gt;
                    &lt;/select&gt;
                &lt;/span&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;Alt Kategoriyi Seçiniz&lt;/td&gt;
            &lt;td&gt;
                &lt;span id="spanSubProList"&gt;
                    &lt;select id="selectSubProList" name="selectSubProList"&gt;
                        &lt;option value="0"&gt;--------------------------&lt;/option&gt;
                        &lt;?
                            $sql="Select * from kategori where ust_kat_id='$posted_parent'";
                            $result=mysql_query($sql);
                            while($row = mysql_fetch_row($result))
                            {
                                $sub_pro_id=$row[0];
                                $sub_pro_name=$row[1];  

                                echo "&lt;option value='".$sub_pro_id."'&gt;".$sub_pro_name."&lt;/option&gt;";
                            }
                        ?&gt;
                    &lt;/select&gt;
                &lt;/span&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;&lt;/td&gt;
            &lt;td&gt;&lt;input type="button" id="buttonList" name="buttonList" value="Search"/&gt;&lt;/td&gt;    
        &lt;/tr&gt;   
    &lt;/table&gt;
&lt;/form&gt;
&lt;div id="list"&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>list.php</p>

<pre><code>&lt;?php
include('../../include/settings.php');
?&gt;

&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="content-type" content="text/html; charset=UTF-8"&gt;
&lt;link rel="stylesheet" type="text/css" href="../../css/mystyle.css" /&gt;
&lt;link rel="stylesheet" type="text/css" href="../../css/tooltip.css" /&gt;
&lt;script src="../../include/all.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
$(document).ready(function(){

    $("img").dblclick(function(){
        var id=$('#hiddenID').val();
        alert(id);
        $("#update_pro").slideToggle();
        $('#update_pro').load('update_list.php?id='+id);
        });





});
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;?php
    $main_cat_id=getGet("main_id"); 
    $sub_cat_id=getGet("sub_id");   
?&gt;
&lt;form&gt;
&lt;table align="center"&gt;
&lt;tr&gt;
&lt;td&gt;    
    &lt;table align="center"&gt;
        &lt;tr&gt;
            &lt;?php
                $sql="SELECT * FROM urun WHERE alt_kat_id='$sub_cat_id' and ana_kat_id='$main_cat_id'";
                $result=mysql_query($sql);
                $count=mysql_num_rows($result);
                $i=0;
                while($row=mysql_fetch_assoc($result,0))
                {
                    $image_dir=$row["resim"];
                    $id=$row["id"];
                    $isim_tr=$row["isim_tr"];
                    $aciklama_tr=$row["aciklama_tr"];
                    if($i!=2)
                    {
                        echo "&lt;td&gt;";
                        echo "&lt;a href='#' class='tt'&gt;&lt;img src='$image_dir' height='150' width='150'/&gt;&lt;span class='tooltip'&gt;&lt;span class='top'&gt;&lt;/span&gt;&lt;span class='middle'&gt;$aciklama_tr--$id&lt;/span&gt;&lt;span class='bottom'&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;br&gt;";
                        echo "&lt;center&gt;&lt;input type='button' id='buttonProDelete' value='Delete' /&gt;&lt;/center&gt;";
                        echo "&lt;br&gt;&lt;center&gt;$isim_tr&lt;/center&gt;";
                        echo "&lt;input type='hidden' id='hiddenID' value='$id' /&gt;";
                        echo "&lt;/td&gt;";
                        $i++;
                    }
                    else
                    {
                        echo "&lt;tr&gt;";
                        echo "&lt;/tr&gt;";
                        echo "&lt;td&gt;";
                        echo "&lt;a href='#' class='tt'&gt;&lt;img src='$image_dir' height='150' width='150'/&gt;&lt;span class='tooltip'&gt;&lt;span class='top'&gt;&lt;/span&gt;&lt;span class='middle'&gt;$aciklama_tr--$id&lt;/span&gt;&lt;span class='bottom'&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;br&gt;";
                        echo "&lt;center&gt;&lt;input type='button' id='buttonProDelete' value='Delete' /&gt;&lt;/center&gt;";
                        echo "&lt;br&gt;&lt;center&gt;$isim_tr&lt;/center&gt;";
                        echo "&lt;input type='hidden' id='hiddenID' value='$id' /&gt;";
                        echo "&lt;/td&gt;";
                        $i=1;

                    }
                }
            ?&gt;
        &lt;/tr&gt;
    &lt;/table&gt;
&lt;/td&gt;
&lt;td&gt;&lt;div id="update_pro"&gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>update.list.php</p>

<pre><code>&lt;?php
include('../../include/settings.php');
?&gt;

&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="content-type" content="text/html; charset=UTF-8"&gt;
&lt;link rel="stylesheet" type="text/css" href="../../css/mystyle.css" /&gt;
&lt;script src="../../include/all.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;

&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;?php 

    $id=getGet("id");
    echo $id;

?&gt;


&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>The problem is that I cannot fetch the real id of image that I double clicked.. I always fetch the first one's id! I want to click the image, after that, I want to show the properties of that image in the same page.How can I do it?</p>
