Hi I really really really need your help since I have no idea about this.

How can I insert the Javascript Confirmation Alert into the del.php file?


I have this del.php file

<?php
require ("include/config.php");
$id=$_REQUEST['id'];

$strSQL = "DELETE FROM change WHERE id = '".$id."' ";  
 $objQuery = odbc_exec($conn,$strSQL);  
 if($objQuery)  
 {  
 
 echo "<script language='Javascript'>alert('Deleted.'); 
	 window.location=\""."index.php?action=syif\"</script>";

 }  
 else  
 {  
 echo "Error Delete [".$strSQL."]";  
 }  
 odbc_close($conn);  


?>

This is the confirmation javascript

<html>
<head>
<script type="text/javascript">
function show_confirm()
{
var r=confirm("Delete?");
if (r==true)
  {
  alert("Deleted!");
  }
else
  {
  alert("Cancelled!");
  }
}
</script>
</head>
<body>

<input type="button" onclick="show_confirm()" value="Show confirm box" />

</body>
</html>

Recommended Answers

All 3 Replies

Normally, we will run the confirmation script to delete data before we proceed into the delete.php

Normally, we will run the confirmation script to delete data before we proceed into the delete.php

I see. But is it possible to add the javascript confirmation into the del.php file?

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.