title: Trying to redirect PHP shopping cart once empty
body: <p>I've created a PHP shopping cart, it's just the redirects that don't work. So when I add an item, it shows a blank page, but if you go to the cart, the item is there. This is how I'm storing the url:</p>
  
  <pre><code>    &lt;?php
         $current_url = $_SERVER['REQUEST_URI'];
         $current_url = substr($current_url, 1);
  
          $results = $conn-&gt;query("SELECT * FROM apps A INNER JOIN device D ON D.DeviceID = A.DeviceID WHERE D.DeviceName = '$os'");
              if ($results) { 
              //output results from database
              while($obj = $results-&gt;fetch_object())
              {
  
                  echo "&lt;div class=\"col-6 col-sm-6 col-lg-4\"&gt;";
                  echo '&lt;form method="post" action="cart_update.php"&gt;';
                  echo '&lt;h2&gt;'.$obj-&gt;ApplicationName.'&lt;/h2&gt;';
                  echo '&lt;p&gt;'.$obj-&gt;ApplicationDescription.'&lt;/p&gt;';
                  echo '&lt;button class="add_to_cart"&gt;Add To Cart&lt;/button&gt;';
                  echo '&lt;input type="hidden" name="product_code" value="'.$obj-&gt;ApplicationID.'" /&gt;';
                  echo '&lt;input type="hidden" name="type" value="add" /&gt;';
                  echo '&lt;input type="hidden" name="return_url" value="'.$current_url.'" /&gt;';
                  echo '&lt;/form&gt;&lt;/div&gt;';
               }
  
              }
       ?&gt;
  </code></pre>
  
  <p>And this is the code that should redirect it back once the cart is empty</p>
  
  <pre><code>    &lt;?php
      session_start(); //start session
      include_once("includes/connect.php"); //include config file
  
      //empty cart by distroying current session
      if(isset($_GET["emptycart"]) &amp;&amp; $_GET["emptycart"]==1)
      {
          $return_url = $_GET["return_url"]; //return url
          session_destroy();
          header('Location:'.$return_url);
      }
  </code></pre>