Hey everyone, I have a question. I have a web app where you have a table that will either update, delete, or add a user. The update works great but the delete is weird. It deletes just fine, but I ask for a confirmation first before the action is completed.
I am using PHP, jquery/javascript, html, and MySQL
This is the code that I used for the button
echo "<td><button type='submit' name='delete' value='".$row['UserID']."' class='delete-button'>Delete</button></td>";
This is the jquery/javascript that I am using
$('.delete-button').on('click', function()
{
var conf=confirm("Are you sure?");
if(conf==false)
{
window.close();
}
});
});
When the user hits the button, the popup comes out asking if they are sure. If they hit the cancel button, the window will close. If they hit okay, they will go to the next page where the Query will be executed to delete the entry.
However, sometimes but not all the time, the entry will be deleted even if the user hits the cancel button. Would anyone know why that is happening?