[FONT=verdana]Sir, I have following codes
// 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>
[/FONT][/COLOR][FONT=verdana]When I press delete button then confirmation apperas but..[/FONT]
[FONT=verdana]In both cases (Yes or No), record is deleted automaticlly.[/FONT]
[FONT=verdana]I think when Delete button is pressed then this part of codes runs immediately without caring Yes or No option.
if(isset($_POST['delete']))
[/FONT][/COLOR][FONT=verdana]The record must not be deleted in case NO button is pressed.[/FONT]
[FONT=verdana]Please help again. Thanks[/FONT][FONT=verdana]
[/FONT]