Here is the extract code of how to make a confim box when delete,
For HTML part
A link is to trigger JS code , but it will trigger the php code at same time
For JS part
popupbox is triggered
For PHP part
Process the sql query, it should be ok
The problems are…
- I should use js to trigger the php page? But how can i let the php page know that which ListID i want to delete?
- What should i put in the html link?
- What if i want to include the list name in the popup box e.g. do you want to delete list A ,where list A is a variable already. The only thing is how can i append it to the popup box
Thank you
HTML
<a id="delete" href='delete.php?id=$set[ListID]'>Delete</a>
JS
$(function(){
$("#delete").click(function() {
// what should be add here?
});
});
PHP
//connection db
INSERT INTO delete_list SELECT * FROM list WHERE ListID=?;
INSERT INTO delete_user_list SELECT * FROM user_list WHERE ListID=?;
INSERT INTO delete_require_attributes SELECT * FROM require_attributes WHERE ListID='2';
INSERT INTO delete_subscriber SELECT * FROM subscriber WHERE ListID=?;
INSERT INTO delete_subscriber SELECT * FROM subscriber WHERE ListID=?;
DELETE FROM list WHERE ListID = '1'
Sorry, I mess up the previous question as i found that the plugin i used in last question does not work for me.
i had done this by giving the id to the HTML element itself with data (HTML5 ref) sweet to use with jQuery.
After this you can do an ajax call optional to delete server-side in the database.
Example
JS