It would be very helpful for me if the path of the caller could be saved. What I mean is, I want to use the same path that I used when I called, let’s say B.php using Page A so that I can still go back the Page A, easily. I’ve been trying this $_SERVER (‘REQUEST_URI’) function but it will be useful for saving the path of destination.  Â
Main Function of $_ SERVER(REQUEST_URL’)
Please first of all, make sure that the code that you are using is written perfectly and you are getting any error that is not related to the syntax.
The correct syntax for this is
<?php
  session_start();
  echo("hello");
  if(isset($_SESSION['variable']))
  {
    echo("bye");
    if($_SESSION['variable'] == 'variable')
    {
      echo("welcome");
      exit;
    }
  }
  ?>
Write this piece of code and see if the problem persists.
The next method is to use a session variable to save the paths in it for later use.
string session_save_path ([ string $path ] )
This string will return the path that is being used. AFter the return process, you can use the path anywhere you want either to go back or to go anywhere else or to come back from any previous location