Passing variables from Jquery to PHP
<p>I have tried everythinng anmad cannot get this prograam to work.  This is a chess program.  When a user double clicks on a square on the board, the cell should be added to the form in the move_to/move_from variable.</p>

<p>Here are code snippits:</p>

<pre><code>&lt;?php
 $results = array(array("Br", "Bn", "Bb", "Bq", "Bk", "Bb", "Bn", "Br"),array("Bp", "Bp", "Bp", "Bp", "Bp", "Bp", "Bp", "Bp"),
            array("", "", "", "", "", "", "", ""),array("", "", "", "", "", "", "", ""),array("", "", "", "", "", "", "", ""),
            array("", "", "", "", "", "", "", ""),array("Wp", "Wp", "Wp", "Wp", "Wp", "Wp", "Wp", "Wp"),
            array("Wr", "Wn", "Wb", "Wq", "Wk", "Wb", "Wn", "Wr"));

?&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"&gt;


    &lt;head&gt;
        &lt;title&gt;Jquery Test&lt;/title&gt;
        &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
        &lt;link type="text/css" href="jq.css" rel="stylesheet" /&gt;
        &lt;link type="text/css" href="jquery-ui-1.8.9.custom.css" rel="stylesheet" /&gt;
    &lt;/head&gt;
&lt;!-- Uses Session Variables --&gt;
        &lt;body&gt;
            &lt;div id="main"&gt;
            &lt;fieldset  id="main_fieldset"&gt;
                &lt;table  cellspacing="100"&gt;
                    &lt;tbody &gt;
                        &lt;tr&gt;
                            &lt;td class="b1"&gt;8&lt;/td&gt;&lt;td class="d1" id="a8"&gt;&lt;?php echo $results[0][0];?&gt; &lt;/td&gt;&lt;td class="a1" id="b8" &gt;&lt;?php echo $results[0][1];?&gt;  
                                &lt;/td&gt;&lt;td class="d1" id="c8"&gt; &lt;?php echo $results[0][2];?&gt; &lt;/td&gt;&lt;td class="a1" id="d8"&gt; 
                                &lt;?php echo $results[0][3];?&gt; &lt;/td&gt;&lt;td class="d1" id="e8"&gt;&lt;?php echo $results[0][4];?&gt;  &lt;/td&gt;&lt;td class="a1" id="f8"&gt; 
                                &lt;?php echo $results[0][5];?&gt; &lt;/td&gt;
                                &lt;td class="d1" id="g8"&gt; &lt;?php echo $results[0][6];?&gt; &lt;/td&gt;&lt;td class="a1" id="h8"&gt; &lt;?php echo $results[0][7];?&gt;  &lt;/td&gt;
                        &lt;/tr&gt;
</code></pre>

<p>snip..</p>

<pre><code>&lt;script type="text/javascript"&gt;
$(document).ready(function(){
        $('.a1').click(function() {
            $(this).css("background-color","grey");
        });
}); 
&lt;/script&gt;

&lt;script type="text/javascript"&gt;
$(document).ready(function(){
        $('.a1').dblclick(function() {
            $(this).css("background-color","blue");
            move_from = $(this).attr("id");
            $.post('jq_test.php',move_from);
            alert(move_from);
    });
});

    &lt;p&gt;&lt;a href="jq_test.php?move_from"&gt;x&lt;/a&gt;&lt;/p&gt;

&lt;?php 
                    echo "this is the variable   ";echo $_GET['move_from'];
                    print_r($_GET);
?&gt;
</code></pre>

<p>snip...</p>

<pre><code>&lt;?php       
    echo &lt;&lt;&lt;HTML
            &lt;form method="post" action="jq_test.php"&gt;
            Move From&lt;input type="text" name="move_from"&gt; &lt;/input&gt;&lt;br /&gt;&lt;br /&gt;
            Move To  &lt;input type="text" name="move_to"&gt;&lt;/input&gt;&lt;br /&gt;&lt;br /&gt;
                &lt;input type="submit" value="Enter Move"&gt;&lt;/input&gt;

            &lt;/form&gt;
    HTML;
?&gt;

    &lt;/body&gt;

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