hello.i need help form you all. i am beginner in php and my english is not good..
my problem is when the pop up message proceed delete, although i click cancel. my data is delete ? this is my coding

<?php session_start(); 

$noC = $_REQUEST['noC'];      
include("db_connect.php");    
mysql_select_db($database_localhost, $conn)or trigger_error(mysql_error(),E_USER_ERROR);

$sql="DELETE FROM cek1a WHERE noC='".$noC."'";  

mysql_select_db($database_localhost, $conn);
                    $Result1 = mysql_query($sql, $conn);
                    if($Result1){
                        echo "<script>confirm('proced delete?')</script>";    
                        echo '<META HTTP-EQUIV="Refresh" CONTENT="0.01; URL=p1f3(delete).php">';
                    }
                    else  
                        echo "<script>alert('Sorry, the data you entered was failed to save.')</script>";
?>

i hope you all can help me.. thank you

seem to be your beginner in PHP and html, please try AJAX for it.

Java-script is Client Side Language.


Following code always delete your row without ask permission or processed.

$sql="DELETE FROM cek1a WHERE noC='".$noC."'";

mysql_select_db($database_localhost, $conn);
$Result1 = mysql_query($sql, $conn);
if($Result1){
echo "<script>confirm('proced delete?')</script>";
echo '<META HTTP-EQUIV="Refresh" CONTENT="0.01; URL=p1f3(delete).php">';
}
else
echo "<script>alert('Sorry, the data you entered was failed to save.')</script>";

thank you for you advise.I appreciate it. but is there are other ways to solve it in php?
your cooperation is greatly appreciated

problem is that following logic is Client Side ..

mysql_select_db($database_localhost, $conn);
$Result1 = mysql_query($sql, $conn);
if($Result1){
echo "<script>confirm('proced delete?')</script>";
echo '<META HTTP-EQUIV="Refresh" CONTENT="0.01; URL=p1f3(delete).php">';
}
else
echo "<script>alert('Sorry, the data you entered was failed to save.')</script>";


you have to make java-script function and confirm box on link where Delete button is placed.

for example :

<script>
function showpoup('ab){
//bla bla alert script of javascript , when user click on true; return to windows.location = "delete.php?id="+.ab.+";
}
</script>


<a onclick="showpoup('23');">Delete Record</a>

thank you very much. i will try it.. thank you :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.