There is a button to delete goods:

<a href="cart.php?id='.$row["cart_id"].'&action=delete" class="btn btn--small btn--secondary cart__remove">Удалить2</a> 

When clicked, it jumps to the page 123.ru/cart.php ? Id = 11 & action = delete

I need that when I clicked the product was also removed, but it was thrown onto page 123.ru

  • Do it. - Daniel

1 answer 1

So at the end of the handler (in the php file) you need to write header

An example of this:

 header('Location: http://123.ru/'); // header("Location: http://".$_SERVER['HTTP_HOST']); exit; 

An error may occur.

Can not modify header information - headers already sent by

because you have to remember:

The header () function can only be called if data has not yet been transmitted to the client. That is, it should go first in the output; there should be no HTML tags, empty lines, etc. before calling it.

You can read more about how to fix this error if it occurs - here: Cannot modify header information - headers already sent

  • again some crazy nonsense suffer - Alexey Shimansky