-6

I've coded a submit button that deletes the user if the user clicks on it. It sends the data to delete_data.php which deletes the data from the SQL db:

Code for the delete button

I've added an onclick attribute the input element, but I want it to display yes/no options and also make sure that if the user clicks "no", it does not send the data to delete_data.php

How can I make this happen? thanks

Michael Berry
  • 70,193
  • 21
  • 157
  • 216

1 Answers1

0

On your form tag add this instead of your button

<form onsubmit="return confirm('Do you really want to delete?');">

I cannot copy/paste your code as it's image, but i hope you understand.

Simos Fasouliotis
  • 1,383
  • 2
  • 16
  • 35
  • I wrote this: onclick="return confirm('Do you really want to delete?'); it worked! – freddyzcount90 Apr 19 '17 at 12:24
  • @freddyzcount90 You should really use `onsubmit` on the form element instead. There are other ways to submit a form than clicking on the submit button, like pressing enter on a form field or button. – JJJ Apr 19 '17 at 13:47