How to pass a variable with in jquery
<p>I just started using jQuery in the past few days. I love how it makes functions simple. However because I am very new to using Javascript, I keep hitting a road block with one function.</p>

<p>I am trying to bind a couple functions together, but I'm not sure if I am doing it in the right order. What I want it to do is get a variable from a selector <code>href='#from=xxxxx&amp;to=xxxxx'</code>, with the <code>xxxxx</code> being a value printed out from a DB using PHP. </p>

<p>Then create a DOM window to display a form and insert those values into the hidden input fields. I have been stuck trying to figure out a way to pass those variables from the link to the form. </p>

<p>Here is my script:</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
  &lt;script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt;
&lt;script src="http://swip.codylindley.com/jquery.DOMWindow.js"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id="msgBox" style="display:none"&gt;&lt;/div&gt;
&lt;?php   $from="0";  $to="0";
for ($x=1; $x&lt;=4; $x++){ $from++; $to++;    ?&gt;
&lt;a href="#from=&lt;?php echo $from;?&gt;&amp;to=&lt;?php echo $to;?&gt;" class="foo"&gt;user&lt;?php echo $x;?&gt;&lt;/a&gt;&lt;br&gt;
&lt;?php } ?&gt;
&lt;script type="text/javascript"&gt;
       $("#msgBox").append("&lt;form id='myForm' method='post' action='index.php'&gt;&lt;div style='border:1px solid #cc0; width:300px;'&gt;&lt;input type='hidden' value='&lt;?php echo $from;?&gt;'&gt;&lt;input type='hidden' value='&lt;?php echo $to;?&gt;'&gt;subject:&lt;input type='text' name='subject'&gt;&lt;br&gt;message:&lt;textarea class='mbox' name='msg'&gt;&lt;/textarea&gt;&lt;br&gt;&lt;input type='submit' value='submit'&gt;&lt;/div&gt;&lt;/form&gt;");
        $('.foo').click(function(){
            $.openDOMWindow({
                windowSourceID:'#msgBox',
                height:135,
                width:300,
                overlay:0,
                positionType:'anchoredSingleWindow',
                windowBGColor:'#f9f5f5',
                anchoredSelector:'.foo',
                positionLeft:200,
                positionTop:150
            });
                  $("#msgBox").trigger();
            return false;
     });
&lt;/script&gt;&lt;/body&gt;&lt;/html&gt;
</code></pre>
