Search code examples
phphrefconfirmation

HTML/PHP Confirmation on href


I have this line of code that executes that runs a delete script for an item with a specific id which is retrieved from the url.

    echo " ( <a href=\"DeleteCategory.php?id="  . $row['id']    .   "\" >Delete</a> )";

How can I add an onclick confirmation that determines if it goes to the link or not. I would rather not have to use any javascript.

Thanks


Solution

  • Add onclick="return confirm ('Are you sure?')"

    Hope that helps.