Hi All,

I have some trouble getting some javascript code implemented

Its basically because I havent used much it before.

Its like this:

When admin chooses to delete a page from his site via this link:

<?php echo '<a href="process_delete_page.php?pid=' . $id . '">Delete page!</a>'; ?>

Before this actually gets processed, i would like to alert admin, with a box, asking if he is sure or not, so he gets the option to regret his choise.

onClick="(return confirm('Are you sure you want to delete the page?'))"

Something like this, probably not correct?

How can I implement that tiny bit of JS in my (PHP)link above?

I hope someone can help out,



That's just about correct.

Here's the HTML/javascript in full (sans php):

<a href="process_delete_page.php?pid=999" onclick="return confirm('Are you sure you want to delete the page?')">Delete page!</a>


Sweeeeeet man :-)

I made it work like this:

echo "<div style=\"inline\"> 
<a href=\"process_delete_page.php?pid=$id\" onclick=\"return confirm('Are you sure You want to delete the page?')\">Slet siden her!

If anyone else out there want to use this tiny javascript alert. If there are any others like me, than isnt sure how to integrate it in a php string with a link...