Hi There,
I have Made Very Basic Example for you that will help you to understand how to use confirmation Box (confirm() JavaScript) in PHP
here is the code :
test.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PHP Page</title>
<script type="text/javascript">
function confirmation(url, id)
{
var where_to= confirm("Do you really want Add the Value??");
if (where_to== true)
{
window.location=url+"?"+id;
}
else
{
alert("Action Aborted By User!")
}
}
</script>
</head>
<body>
<a href="javascript:void(0);" onClick="confirmation('test.php', 'val=Just Testing')" id="links">Link Text</a>
<?php
if($_GET['val'] != "")
{
echo "this value came From Last Page: ".$_GET['val'];
}
?>
</body>
</html>
I hope this code will help you
Rahul Dev Katarey