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,
Creaet Delete.php File
create DBConnect.php File
Create index.php file
I think this will help you :)
Let me know if you are finding any problem.
Try Something like this ---
You have to use AJAX for this
use this tutorial
Deleting values from MySQL database with AJAX without page reload (edited)
It will help you out.
Either you can use php function header('location:yourPage.php'); or do with the help of Ajax.
You should use
Ajax
. Try maybe withjQuery
:http://api.jquery.com/jQuery.ajax/
Then
onSuccess
method delete row using jQuery too.