title: Keeping variables from PHP while loop
body: <p>I have been looking all over for a way to do this.</p>
  
  <p>I use a PHP while loop to get some variables from a database:</p>
  
  <pre><code>&lt;?php while ($row = mysql_fetch_array($query)) {
  $id = $row["ID"];
  ?&gt;
  
  &lt;script type="text/javascript"&gt;
  &lt;!--
  function go_there()
  {
  var id= "&lt;?php echo $id ?&gt;"
  var where_to= confirm("Are you sure you want to delete?");
   if (where_to== true)
   {
     window.location="index.php?p=delete&amp;id=" + id;
   }
   else
   {
  
    }
  }
  //--&gt;
  &lt;/SCRIPT&gt;
  &lt;td&gt;&lt;form&gt;&lt;INPUT TYPE="button" value="Go!" onClick="go_there()"&gt;&lt;/form&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;? } //end while
  ?&gt;
  </code></pre>
  
  <p>Sometimes i get 10 results, and i make 10 Go! bottoms. But when i come to the delete page, the $is variable is off cause the same as the last result, no matter witch of the bottoms i press..</p>
  
  <p>Any ideas on how to get around that, so i get the confirm box, and still keep the right id to be deleted?</p>