title: Passing the ID of clicked link to PHP code without reloading the page
body: <p>I am trying to pass the ID of a clicked link to PHP code without reloading the page.</p>
  
  <p>Currently, I am using the following code to pass the ID in the href attribute in the tag:</p>
  
  <pre><code>&lt;?php
      $sql="select * from category";
      $execute=mysql_query($sql);
      while($row=mysql_fetch_assoc($execute)){ ?&gt; 
              &lt;li&gt;&lt;a href="index.php?did=&lt;?php echo $row['id']; ?&gt;" onclick="javascript:show()"&gt;&lt;?php echo $row['category'] ; ?&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;?php 
      } 
  ?&gt;
          &lt;/ul&gt;
      &lt;/div&gt;
      &lt;div id="waxing" style="display:none"&gt;
          &lt;h2 id="cat_price" style="color:#f5c658"&gt;Price Category Waxing&lt;/h2&gt;
          &lt;ul class="ul1"&gt;
  &lt;?php 
      function sub() {
          if(isset($_GET['did']))
          {
              $id=$_GET['did'];
              $sql="select * from midcat where cid=$id";
              $execute=mysql_query($sql);
              if(mysql_num_rows($execute)&gt;0){
                  while($row=mysql_fetch_assoc($execute)){ 
                  ?&gt;
                      &lt;li&gt;&lt;a href="#" id="wax_normal" &gt;&lt;?php echo $row['midcat']; ?&gt; &lt;/a&gt;&lt;/li&gt;
                  &lt;?php 
                  }
              }
          }
      }
      sub();
  ?&gt;
  </code></pre>
  
  <p>Is it possible to do the same thing without reloading the page?</p>