Works perfectly on localhost but wont redirect live.
The redirect function is
function redirect_to($location = NULL){
if ($location != NULL) {
header("Location: {$location}");
exit;
}
}
and one of the pages not working is
<?php
$pid = $_POST['id'];
$q = $_POST['qty'];
// if($pid<1 or $q<1) return;
if(is_array($_SESSION['cart'])){
// if(product_exists($pid)) return;
if(product_exists($pid)){
$max=count($_SESSION['cart']);
for($i=0;$i<$max;$i++){
if($_SESSION['cart'][$i]['productid'] == $pid){
$_SESSION['cart'][$i]['qty'] = $_SESSION['cart'][$i]['qty'] + $q;
}
}
}else{
$max=count($_SESSION['cart']);
$_SESSION['cart'][$max]['productid']=$pid;
$_SESSION['cart'][$max]['qty']=$q;
}
}
else{
$_SESSION['cart']=array();
$_SESSION['cart'][0]['productid']=$pid;
$_SESSION['cart'][0]['qty']=$q;
}
redirect_to("viewcart.html");
?>
Thanks in advance for the help