This question already has an answer here:
How to add onClick
event on <a>
tag which contains php
variables
$delete = "<a onclick='return confirmDelete('deleterecord.php?chkid=$sl&table=$getid&path=$validURL');'><img src='images/dustbin.png' width='43px' height='30px'></a>"; // link not pass
//script
<script>
function confirmDelete(delUrl) {
if (confirm("Are you sure you want to delete")) {
window.location = delUrl;
}
}
</script>
</div>