how to delete a record by clicking a button

how to delete a record by clicking a button

ladanladan Posts: 1Questions: 1Answers: 0
edited September 2018 in Free community support

I created a page with the intention to retrieve a record from a database and also required to delete a record by clicking on delete button. Now i am able to develop the page with retrieved data from my database but I tried to write a code that will enable the page to delete a selected record or tuple but I could not do it. pls, I need your help, the source code is given here below:

<!DOCTYPE html>
<html lang="en-US">
  <title>viewing chairmens</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="bootstrap.min.css">
  <link rel="stylesheet" type="text/css" href="project.css">
  <link rel = "stylesheet" type="text/css" href="W3.css">
<div class="header">
<nav class="navbar navbar-inverse">
  <div class="container-fluid">
    <ul class="nav navbar-nav">
      <!-- <li><a href="admin_page.php#" onclick="document.getElementById('id04').style.display='block'">Assign Chairman</a></li>
       --><li><a href="view_signup.php" class="w3-button w3-#800000 w3-large">Assign Chairman</a></li>
      <li class="active" ><a href="view_chairmens.php">View Chairmen</a></li>
      <li><a href="view_members.php" class="w3-button w3-#800000 w3-large">View Association's Members</a></li>
   <li><a href="view_applicant.php" class="w3-button w3-#800000 w3-large">View Loan Applicantions</a></li>
     <ul class="nav navbar-nav navbar-right">
      <li><a href="index.php" class="w3-button w3-#800000 w3-large"><span class="glyphicon glyphicon-log-out"></span> Logout</a></li>

<div id="section">
<div class="table-responsive">
              <table class="w3-table w3-striped w3-border w3-hoverable w3-bordered">
                <caption style="text-align: center; font-weight: bold; font-family: tahoma; font-size: 18px;">List of Assigned Chairmens</caption>
                    <th>Association Name</th>
                      $querry2 = "SELECT * FROM login ORDER BY id";
                      $result2 = $conn->query($querry2);
                      if ($result2->num_rows>0) 
                        while ($row = $result2->fetch_assoc()) 

                            <td style="font-size:14px; font-weight:bold; "><button class="btn btn-danger">Delete</button></td>
                        alert("No Record in this table !!!");
<footer><p> Copyright &copy; 2018. All Rights Reserved</p></footer>


  • kthorngrenkthorngren Posts: 5,543Questions: 19Answers: 1,233

    Are you using Datatables? If so please post your Datatables code/


Sign In or Register to comment.