In PHP, how would I go about storing the variable "backurl"? (retrieved as shown below at the bottom - when the following constraints need to apply)
i.e.
FROM -> TO (actual outcome - desired outcome)
page1.php -> page2.php (link goes to page1.php - as intended)
page2.php -> page2.php?test=yes (link goes to page2.php - I want it to go back to page1.php)
If anyone has any suggestions of how to do this, thank you very much!
$backurl = $_SERVER['HTTP_REFERER'];
you could use sessions
<?php
session_start();
if(!isset($_SESSION['backurl'])){
$_SESSION['backurl'] = $_SERVER['HTTP_REFERER'];
}
?>
$_SESSION['backurl']; //contains the back url;
and if you nee to unset the backurl:
unset($_SESSION['backurl']);