how to collaborate between javascript and php
<p>i am calling a javascript for image gallery and php on a single page.
let me show you some code to make things clear:</p>

<p><strong>PHP</strong>


<pre><code>echo "&lt;form method = post action = 'user_submit.php'&gt;";

// get possible answers using question ID
$query = "SELECT aid, atitle FROM answers WHERE qid = '$qid' ORDER BY aid ASC";
$result = mysql_query($query) or die("ERROR: $query.".mysql_error());

if (mysql_num_rows($result) &gt; 0) {
while ($row = mysql_fetch_object($result)) {
echo "&lt;div id=captionbox style='width: 110px;float:left;color:#FFF;text-align:center;'&gt;";
echo "&lt;a href='#' class='thumb' &gt;&lt;img class='thumb-img' src='images/roadies/th".$row-&gt;aid.".jpg' /&gt; &lt;/a&gt;";
echo "&lt;input  type = hidden name = aid id = rd".$row-&gt;aid." value = ".$row-&gt;aid."&gt;".$row-&gt;atitle."&lt;/input&gt;";
      echo "&lt;/div&gt;";
     }

echo "&lt;input type = hidden name = qid value = '".$qid."'&gt;";
echo "&lt;br/&gt;";
echo "&lt;input type = submit name = submit value = 'Vote!'&gt;";
       }

  echo '&lt;/form&gt;';
</code></pre>

<p>}</p>

<p>the above code fetches object ids and places jpeg images accordingly (thumbnails).
now when i click on these thumbnails the javascript opens an overlay to display the large version. i want to pass the value of <code>$row-&gt;aid</code> to javascript.</p>

<p>then from the javascript i want to fill out a form and pass the <code>$row-&gt;aid</code> and the form to <code>user_submit.php</code> to add it to the DB.</p>

<p>i am new to php. please help me out.</p>
