I want to track the referring url, only when it doesn't contain certain variables. So when I go from page.php?category=100 (viewing, say, Apples) to page.php?id=5 (viewing, say, Golden Delicious Apples), and if I click on add to basket (making the url page.php?id=5&action=add), I want to not track the $action so when I click 'back', it takes me back to the category page instead of the id page. Does that makes sense? I'm sure it's feasible I just can't wrap my head around the syntax.
So something kinda like:
session_start();
$queryString = $_SERVER['QUERY_STRING'];
parse_str($queryString, $params);
if ($params !contain $action || $liked) {
$referrer = 'page.php?' . $_SESSION['referrer_querystring'];
}
echo '<a href="' . $referrer . '">BACK</a>';
Saying if the referrer_querystring session doesn't contain an action or liked variable, then save the referrer, otherwise, don't save it. It's boggling my mind and I'm about to go on a rampage through the office. Can anyone help me break that down?