 <p>Well you said without redirecting. Well its a javascript code:</p> <pre><code>&lt;a href="JavaScript:void(0);" onclick="function()"&gt;Whatever!&lt;/a&gt; &lt;script type="text/javascript"&gt; function confirm_delete() { var delete_confirmed=confirm("Are you sure you want to delete this file?"); if (delete_confirmed==true) { // the php code :) can't expose mine ^_^ } else { // this one returns the user if he/she clicks no :) document.location.href = 'whatever.php'; } } &lt;/script&gt; </code></pre> <p>give it a try :) hope you like it</p>