Thanks for helping, now I have following modified codes
[php]<?php
require_once(“connect.php”);
// DELETE
if(isset($_POST['delete']))
{
// Get values from form
$sno = $_POST['txtsno'];
$pro = $_POST['txtpro'];
$wet = $_POST['txtwet'];
//$query = "delete from test WHERE sno='".$sno."'" ;
$query = "delete from ghee WHERE sno={$sno}" ;
$result = mysqli_query($con, $query);
if(!$result) {
echo "<script>alert('Record not deleted')</script>";
}else{
echo ("<script>alert('Record deleted successfully')</script>");
}
}
?>
<form name="form1" action="" method="post">
<table border=0; cellpadding="1" cellspacing="1" bgcolor="" align="center" >
>
<div style=text-align:center;margin-top:20px;>
<input type="submit" name="delete" value="Delete" onclick="return (window.confirm('Do you really want to delete this record?') ? 1 : 0);"
</div>
</form>
[/php]
When I press delete button then confirmation apperas but…
In both cases (Yes or No), record is deleted automaticlly.
I think when Delete button is pressed then this part of codes runs immediately without caring Yes or No option.
[php]if(isset($_POST[‘delete’]))[/php]
The record must not be deleted in case NO button is pressed.
Please help again. Thanks