I have a link with ‘remove’ anchor text with href something like below:
./index.php?del_id=5
When I click the link, the record will be deleted and a message will be shown that ‘The record has been deleted.’ but the problem is that del_id=5 will be in the address bar. If I redirect the user to index.php then I’d lose the message.
How should I delete a record, show a message, and have a clear link without del_id=5?
Here’s three options:
Instead of using a link to delete, POST a form. This will ensure the
idis kept out of the URL.Create a message queue system. When it’s deleted, add a message to a queue in the session, then redirect to index.php and display any messages in the queue, then clear the queue.
Do the delete action via an ajax call so that the page doesn’t change at all.