In order to delete a row or a set of rows from the data base table, you will need to make a POST-method request to a script that runs a DELETE query. The common design pattern for something like what you've shown here goes this way (sorry there is not a simple answer). The "X delete entry" column contains a link to a delete script. The link looks like this URL: <a href="delete.php?q=$id">delete</a> In that URL, the $id variable is the key of the data base row to be deleted. When the script is started via a click on the link, it is started via a GET request. The variable $_GET['q'] contains the id. The script will use the id to SELECT the row and display some of its information, perhaps the company name, along with the question, "Do you really want to delete?" Below the question will be an HTML submit control that makes a POST method request to the deletion script, passing the id. The DELETE query will have a WHERE clause that identifies the target row and a LIMIT clause that sets the query to remove only one row. The nature of the "delete" option is a little complicated. You need to understand the HTTP protocols to know why a POST request is required, but an example might help. Imagine if you had a delete script that used the GET method request. In a GET request, the request information is transmitted in the URL variable. If a script made a DELETE query on the basis of the URL variable alone, there would be a risk, to say the least. Now imagine what will happen when Google visits your page and tries to index all of the links. Poof! All rows are gone.
|TCPDF HTML Table of Contents how can I create leading dots||7||43|
|Popup to change image and store url in database||2||31|
|PHP script redirecting to URL not working on AWS EC2 after Elastic IP||12||67|
|Make custom query_posts look show the excerpt only||9||26|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
18 Experts available now in Live!