Hello to everyone,
I am trying to create a .php file that delete database rows with a popup window that confirmates the action.
I know that are a dozen of examples, but after meany tries do to that I was not able do that, because I haven't knowledge about javacript. Also posted something before here on daniweb, but with no response.
After some researches I found this(link) example source code github link.
Here is a simplified code that I have managed to "create", but I only get the popup windows when I click on delete action of Item I. Could someone help me with this?!
<?php
//Here goes the delete procedure, but I have no problem here
?>
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>Title</title>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="../jquery.confirm.js"></script>
</head>
<body>
<div class="container">
<table class="table">
<thead>
<tr>
<th class="col-lg-3">#</th>
<th class="col-lg-1">Name</th>
<th class="col-lg-8">Action</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Item 1</td>
<td><a id="simpleConfirm" href="index.php?action=delete?id=1" class="btn btn-primary">Delete</a></td>
</tr>
<tr>
<td>2</td>
<td>Item 2</td>
<td><a id="simpleConfirm" href="index.php?action=delete?id=2" class="btn btn-primary">Delete</a></td>
</tr>
<tr>
<td>3</td>
<td>Item 3</td>
<td><a id="simpleConfirm" href="index.php?action=delete?id=3" class="btn btn-primary">Delete</a></td>
</tr>
</tbody>
</table>
<script>
$("#simpleConfirm").confirm();
$("#complexConfirm").confirm({
title:"Delete confirmation",
text: "This is very dangerous, you shouldn't do it! Are you really really sure?",
confirm: function(button) {
button.fadeOut(2000).fadeIn(2000);
alert("You just confirmed.");
},
cancel: function(button) {
button.fadeOut(2000).fadeIn(2000);
alert("You aborted the operation.");
},
confirmButton: "Yes I am",
cancelButton: "No"
});
$("#dataConfirm").confirm();
$("#manualTrigger").click(function() {
$.confirm({
text: "This is a confirmation dialog manually triggered! Please confirm:",
confirm: function() {
alert("You just confirmed.");
},
cancel: function() {
alert("You cancelled.");
}
});
});
</script>
</div>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js"></script>
<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>
</body>
</html>