title: passing variable from a href to pop up box through php
body: <p>after i click on this a href, it ll pop out a form and i trying to pass a variable to the pop up form. This is in a while loop.</p>
  
  <pre><code>while($row = mysql_fetch_array($result))                                    
  {
  $id=$row['file_id'];
  echo '&lt;span class=right&gt;&lt;a href="#edit_form?id='.$id.'"&gt;[edit]&lt;/a&gt; 
  }
  </code></pre>
  
  <p>This is the pop up form code</p>
  
  <pre><code>&lt;a href="#x" class="overlay" id="edit_form"&gt;&lt;/a&gt;
          &lt;?php
              $con=mysql_connect("localhost","root","");
              mysql_select_db("isiti");
              if (mysqli_connect_errno($con))
                  {
                      echo "Failed to connect to MySQL: " . mysqli_connect_error();
                  }
              if (isset($_GET["id"])) 
              {                           
                  $id =$_GET["id"];
              }
              $result = mysql_query("SELECT * FROM publication where file_id='$id'");
              $row1 = mysql_fetch_array($result);
              $title=$row1['title'];
              $author=$row1['author'];
              $year=$row1['year'];
              $abstract=$row1['abstract'];
  
                          if(!empty($_SESSION['username']))
                          {
                          echo'&lt;div class="popup"&gt;';
                               echo'&lt;form method="POST" action="public_edit.php" enctype="multipart/form-data"&gt;';
                                          echo'&lt;div&gt;';
                                              echo'&lt;label for="citation"&gt;Title&lt;/label&gt;';
                                              echo'&lt;input style="width:100%;" type="text" name="title" id="title" value="'.$title.'"&gt;';
                                          echo'&lt;/div&gt;';
                                          echo'&lt;div&gt;';
                                              echo'&lt;label for="citation"&gt;Author&lt;/label&gt;';
                                              echo'&lt;input style="width:100%;" type="text" name="author" id="author" value="'.$author.'"&gt;';
                                          echo'&lt;/div&gt;';
                                          echo'&lt;div&gt;';
                                              echo'&lt;label for="citation"&gt;Year&lt;/label&gt;';
                                              echo'&lt;input style="width:100%;" type="year" name="year" id="year" value="'.$year.'"&gt;';
                                          echo'&lt;/div&gt;';
                                          echo'&lt;div&gt;';
                                              echo'&lt;label for="abstract"&gt;Abstract&lt;/label&gt;';
                                             echo'&lt;textarea name="abstract" id="abstract" size="5000"&gt;'.$abstract.'&lt;/textarea&gt;';
                                          echo'&lt;/div&gt;';
                                          echo'&lt;p&gt;Rechoose your file here&lt;/p&gt;';
                                          echo'&lt;input type="hidden" name="MAX_FILE_SIZE" value="2000000"&gt;';
                                          echo'&lt;input name="userfile" type="file" id="userfile"&gt;&amp;nbsp;';
                                          echo'&lt;br/&gt; ';
                                          echo'&lt;input name="submit" type="submit" value="Upload" style="width: 150px"&gt;';
                                  echo'&lt;a class="close" href="#close"&gt;&lt;/a&gt;';
                                  echo'&lt;/form&gt;';
                          echo'&lt;/div&gt;';
                          }
  </code></pre>
  
  <p>The problem i faced is that it do not pass the right id. no matter what link i click it show the data from the first id.</p>
  
  <p>Thanks for helping me .</p>