.

.

delete by using onclick event in image by using Js and Php on

This is an image in which we call functio for delete

<img src="images/delete.png" onclick="sure('deletecategory.php?id=<?php echo base64_encode($cat['cat_id']); ?>', 'Delete');">




<script language="javascript" ?>
function sure(vr, ac){

var sur=confirm("Are you sure ! You want to "+ ac +" Category from this list");
if(sur==true){
//document.banner.action=vr;
//document.banner.submit();
window.location.href=vr;
return true;
}else{
return false;
}

}
</script>
deletecategory.php

<?php
require_once '../config.php';
include 'includes/init.php';

session_start();
$catid=base64_decode($_GET['id']);?>




<?php
$del=$cat->DeleteCategory($catid);
if($del==1)
{
$_SESSION['msg']="Deleted Successfully";
header('Location:viewcategory.php');


}



?>





EmoticonEmoticon