Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8583007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:26:03+00:00 2026-06-11T21:26:03+00:00

I have HTML and PHP code as below: HTML <a href=deleteData.php?id=<?php echo $value[‘id’]?>><button name=delte

  • 0

I have HTML and PHP code as below:

HTML

<a href="deleteData.php?id=<?php echo $value['id']?>"><button name="delte" class="btn">Delete</button></a>

deleteData.php

<?php
include ('include/connectdb.php');
$getid = $_GET['id'];
$sql = ("UPDATE tblworkfaire SET status=0 where id = ".$getid);
$res = mysql_query($sql) or die (mysql_error());

?>

This works great except that after the record is deleted the record is still displayed on the page until it is refreshed.How do I fix this.Anyone have any idea help me please.Thanks,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:26:04+00:00Added an answer on June 11, 2026 at 9:26 pm

    Creaet Delete.php File

     include_once'DBConnect.php';
     if(isset($_REQUEST['userid']) && $_REQUEST['userid'])
     {
     $delObj= new DBConnect();
     $delObj->DeleteData($_REQUEST['userid']);
     }
    

    create DBConnect.php File

    <?php
    
    class DBConnect
    {
    function DBConnect()
    {
        $link= mysql_connect("localhost","root","")or die("Local Host Error".mysql_error());
        mysql_select_db("mydb");
    
    }
    
     function viewData()
    {
    
        $query="select * from userinfo";
        $resultset=mysql_query($query) ;
    
        return $resultset;
    
    
    }
    
    function DeleteData($userID)
    {
    
        $query="DELETE from userinfo where id=".$userID;
    
        $resultset=mysql_query($query) ;
    
    }
    
    
    }
    
    ?>
    

    Create index.php file

    <script>
    function deletedata(id)
    {
        var xmlhttp;    
        if (id=="")
          {
              document.getElementById("Display").innerHTML="";
              return;
          }
        if (window.XMLHttpRequest)
          {// code for IE7+, Firefox, Chrome, Opera, Safari
              xmlhttp=new XMLHttpRequest();
          }
        else
        {// code for IE6, IE5
              xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function()
        {
              if (xmlhttp.readyState==4 && xmlhttp.status==200)
              {
                window.location.reload()
    
              }
        }
            xmlhttp.open("GET","delete.php?userid="+id,true);
            xmlhttp.send();
    
    }
    </script>    
    
    
    
    
    <?php include 'DBConnect.php';
    $ViewObj= new DBConnect();
    $ResultSet=$ViewObj->viewData();?> // I have created one function which will get all the data from the database if you don't want to do this just call deletedata() function onClick event and pass Record ID as agrument which you want to delete on DELETE button.
    <br /><br /><br />
    <span id ="Display">
    <table align="center" border="1">
    <tr>
          <th>Name</th>
          <th>operation</th>
    </tr>
    <?php
    while($row= mysql_fetch_array($ResultSet))
    {?>
    
    
    <tr>
        <td><input type="checkbox"></td>
        <td><?php echo $row[1];?></td>
    
        <td align="center"><a href="#" onclick="deletedata('<?php echo $row[0];?>')" style="color:#FF0000"><b>Delete</b></a>
    
        </td>
    </tr>
    
    <?php 
    
    
    }
    ?>
    </table>
    

    I think this will help you 🙂

    Let me know if you are finding any problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a line of php code that looks like this: echo <script>$('#edit_errors').html('<h3><em>Please Correct
I have this code snippet in an email layout: <div> <?php echo $this->Html->image('Layouts/default/Logo.png', array(
I have a simple html file with the code below. It calls submitform.php. But
I'm having a strange problem. I have a HTML page with PHP code which
I have some PHP code that generates a calendar and then outputs html to
i have create a form (so it's PHP and HTML hybrid-code). it has ability
I have a chunk of HTML code (with some PHP vars echoed inside of
I have the following code: <?php if ($x == 1){ ?> <b>Some html...</b> <?php
I have a html structure in my webpage as below : <div class=group_name>Group A</div>
I have a mysqli/php code below where it is suppose to insert data into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.