Skip to content Skip to sidebar Skip to footer

I Want To "intercept" A Delete Button Press

I would like to 'intercept' a delete button press - I believe this is possible with Javascript? I don't know the exact terminology. Here's my code:

Solution 2:

Without any JavaScript framework, the simplest thing would be to add an onclick attribute

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

Note that your PHP code should read

<button type="submit" name="del" value="' . htmlspecialchars(stripslashes($cultrow["cult_id"])) . '">Del</button>

To avoid cross-site scripting vulnerabilities you must always HTML-escape any data you output to the page. You are also missing the double quotes at the value attribute.


Post a Comment for "I Want To "intercept" A Delete Button Press"