title: PHP Onclick action for a button
body: <p>following is my code that I have used,</p>
  
  <pre><code> if ($status=='Pending'){
     echo '&lt;td&gt;'.'&lt;a href="leave_request.php?leave_id='.$id1.'"&gt;&lt;input type="button" name="submit" class="btn btn-success" value="Approve" "&gt;&lt;/button&gt;&lt;/a&gt;'.'&lt;/td&gt;'
  
      if(isset($_POST['submit'])){
         $id2=$_GET['leave_id'];
          $result= "UPDATE emp_leaves  SET approval_status='Accepted' WHERE leave_id='$id2'";
          $query=mysql_query($result);
      }
   }
  </code></pre>
  
  <hr>
  
  <p>When user click Accept button, URL will get leave_id of clicked leave_request and will reload page itself. I want to update leave_status column of identified leave_id as 'accepted' while reloading the page. How can I do it.</p>