For my web application (PHP/MYSQL), I show a list of items and a link on each row to delete the item. Right now, the link is
<a href='item.php?id=3&action=delete'>Delete Item</a>
If I wanted to use POST instead… how would I do it (this is a dynamically generated list)? Can I send POST data without the use of a form?
Or, for every item, would I have to do:
<form action='item.php?id={$item_id}' method='POST'> <input type='hidden' name='action' value='delete'> <input type='submit' value='delete item'> </form>
and style the submit button to look like the original link?
I am not familiar with php CURL or REST, would they help address this issue?
In general it’s not a good idea to have a GET request that modifies the system state somehow, like deleting an item.
You could have your form look like this: