Wrap that whole section of code with the same IF statement trigger used for the add to cart:
if (isset($_POST["siteCart_1_ATC"]) || isset($_POST["siteCart_1_ATC_x"])) {
that way it will only redirect when someone has clicked the add to cart button and the recordset is properly filtered.


