如何纠正服务器中的php重定向错误

I have error redirection in server for php shopping cart what I have done so far is in jquery I have to send item id and unit price to shop-cart.php

my code in js is

var id = getUrlParameter('id');
var unitprice=$(".couponPrice").text(); 
window.location = 'shop-cart.php?id=' + id +'&unitprice='+ unitprice;

when I click on "add to cart" button it redirects to

www.domainname/shop-cart.php?id=sp_gt1&unitprice=1

and in shop cart I have to generate an order id and my shop-cart.php code is

<?php
ob_start();
session_start();
//error reporting
include "script/db.php";
error_reporting(E_ALL);
ini_set('display_errors','1');
error_reporting(E_ERROR | E_PARSE);
?>


<?php
////////order id generate/////////
date_default_timezone_set('Asia/Kolkata');
        $stamp = date("ymdhis");

$orderid = $stamp;


if(isset($_GET['OrderId']))
{
    $_SESSION['OrderId']=$_GET['OrderId'];
}


/////////////////////////////////////////////////////////////////////////////
// SECTION-1     (if you want to add items to your shopping cart)
/////////////////////////////////////////////////////////////////////////////
if (isset($_GET['id'])) 
{

    $pid = $_GET['id'];
    $quantity=1;
    $unitprice=$_GET['unitprice'];

    $wasFound = false;
    $i = 0;

    // If the cart session variable is not set or cart array is empty
    if (!isset($_SESSION["cart_array"]) || count($_SESSION["cart_array"]) < 1)                  { 

        // RUN IF THE CART IS EMPTY OR NOT SET
        $_SESSION["cart_array"] = array(0 => array("item_id" => $pid, "quantity" => $quantity,"unit_price"=>$unitprice));
    } 
    else 
    {
        // RUN IF THE CART HAS AT LEAST ONE ITEM IN IT
        foreach ($_SESSION["cart_array"] as $each_item) { 
              $i++;
              while (list($key, $value) = each($each_item)) {
                  if ($key == "item_id" && $value == $pid) {
                      // That item is in cart already so let's adjust its quantity using array_splice()
                      array_splice($_SESSION["cart_array"], $i-1, 1, array(array("item_id" => $pid, "quantity" => $each_item['quantity'] + 1,"unit_price"=>$unitprice)));
                      $wasFound = true;
                  } // close if condition
              } // close while loop
           } // close foreach loop
           if ($wasFound == false) 
           {
               array_push($_SESSION["cart_array"], array("item_id" => $pid, "quantity" => $quantity,"unit_price"=>$unitprice));
           }

    }//else
    header("location:shop-cart.php?OrderId=".$orderid);
            exit();

}//if
?>

my problem is when I click on add to cart button in localhost it shows

http://localhost/mydomainname/shop-cart.php?OrderId=151011020441

but in online server it shows

http://domainname/shop-cart.php?id=sp_gt1&unitprice=1 

and rest of the body shows blank. I want it to redirect to show orderId as shown in localhost, any help will be appreciated.

        $("#add-to-cart").click(function(e) {
    e.preventDefault();
    error();

}); 
function error(){
      function getUrlParameter(sParam)
{
    var sPageURL = window.location.search.substring(1);
    var sURLVariables = sPageURL.split('&');
    for (var i = 0; i < sURLVariables.length; i++) 
    {
        var sParameterName = sURLVariables[i].split('=');
        if (sParameterName[0] == sParam) 
        {
            return sParameterName[1];

        }
    }
}  
var id = getUrlParameter('id');
var unitprice=$(".couponPrice").text(); 


        window.location = 'shop-cart.php?id=' + id +'&unitprice='+ unitprice;




    };//add-to-cart//// 

@RamRaider

/* For testing only - comment out if the orderid is set correctly */
exit( 'The value of $orderid is: '.$orderid );

/* Notice the space after the colon. Also, you can combine with exit() */
exit( header( "location: shop-cart.php?OrderId=".$orderid ) );