I’m trying to rest the javascript back history counter in my code back to 0 if I come to my cart.php page from another page on my site. Everything’s working the way I want it to right now except I can’t get the counter to reset. I’m loading the page in an Iframe in my shop with java script if the referrer equals the cart.php itself otherwise I load a referrer link with javascript. The counter keeps indexing on a cart update and when I come back to it from another page. I need it to rest to 0 when I come from another page but keep counting the way it does now on a cart.php refresh or update. Any thoughts would be greatly appreciated.
[php]<?php
session_start();
$referer = $_SERVER[‘HTTP_REFERER’];
$mystringa = '<a style="text-decoration:none; color:inherit; font-family:inherit; font-size:25px;" href="javascript:history.go(';
$mystringb = ')" title="Return to the previous page">« Continue Shopping </a>';
if ( $referer != “http://mydomain.com/shop/cart.php” ) {
unset($_SESSION[‘refresher’]);
}
else if (!isset($_SESSION['refresher'])) {
$_SESSION['refresher'] = 0;
}
else {
$_SESSION['refresher']--;
}
?>
Refresher
<?php echo $mystringa; echo $_SESSION['refresher']-1 ; echo $mystringb; ?> [/php]