I have a function that I call with ?clear-cart
appended to the end of my page; as you can probably guess, this function clears the user\'s cart.
I call it l
Have the page http://test.local/cart link to the page http://test.local/cart?clear-cart, which then redirects the user back to http://test.local/cart.
/cart -> /cart?clear-cart -> /cart
if (isset($_GET['clear-cart'])) {
// Do some cart clearing...
// Redirect back
header('Location: /cart');
exit; // Very important, otherwise the script will continue until it finally redirects
}