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

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

Jump to Post

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?

No. You have to use it wherever you call del.php

Be a part of the DaniWeb community

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