title: PHP Dynamic Table with edit/delete links to open a popup
body: <p>I built a form where user can enter Country Name and Country's Dialing Code. That form submits to Database and then I pull the record from database in a Table showing Country Name, Country's Dialing Code and two more options of EDIT and DELETE (having GET URL Link e.g. www.abc.com/country.php?country=Pakistan)</p>
  
  <p>I want to add AJAX to it so that when user clicks on EDIT or DELETE link a relevant pop-up open with data from GET URL.</p>
  
  <p>Following is my Dynamic Table in PHP</p>
  
  <pre><code>&lt;div&gt; 
  &lt;?php 
      $q = "SELECT * FROM country";
      $result = mysqli_query($conn, $q);
      echo "&lt;table border=2&gt;&lt;tr&gt;&lt;th&gt;Country Name&lt;/th&gt;&lt;th&gt;Country Code&lt;/th&gt;&lt;th&gt;&lt;/th&gt;&lt;th&gt;&lt;/th&gt;&lt;/tr&gt;";
  
      while($a = mysqli_fetch_array($result)) { 
          $cn = $a['cname'];
          $cc = $a['ccode'];
  ?&gt;
  &lt;tr&gt;
  &lt;td&gt;&lt;?php echo $cn ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $cc; ?&gt;&lt;/td&gt;
  &lt;script type="text/javascript"&gt; 
      var a = 0;
      var cname = new Array("&lt;?php echo $cn;?&gt;");
      a++;
  &lt;/script&gt;
  &lt;td&gt;
      &lt;a href='#' onclick='javascript:editWin(cname[a]); return(false);'&gt;Edit&lt;/a&gt;
  &lt;/td&gt;
  &lt;td id="&lt;?php echo $cn;?&gt;"&gt;
      &lt;a href='#' onclick='javascript:delWin(); return(false);'&gt;Remove&lt;/a&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;?php       
      }
  ?&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>My external Javascript Function is as follows</p>
  
  <pre><code>function editWin(e) {
      window.open('edit.php?country='+e,'','height=400, width=600, top=100,
                   left=400, scrollable=no, menubar=no', '');
  };
  </code></pre>
  
  <p>In GET Url it says undefined when popup window opens.</p>