I believe what you want is called BREADCRUMBS
What to use for navigation chain storage is actually up to you. You might even use
if you want, but that'd be unreliable as it's client-side. Usual way to store such chain is actual URI or session.
For example, you have such URI: http://www.example.com/post_manager/post
Then you can iterate through explode(
) to get each step.
That's basic explanation to guide you to a right direction. You can google a lot of samples and snippets using keyword breadcrumbs.
On the topic of saving last visited location (the way to determine whether auser came from manager or homepage): you can use session's variables to do that. Here's an example:
This way you can set a variable on your homepage:
$_SESSION['previous_location'] = 'homepage';
And then you just access it from another page:
$previous_location = $_SESSION['previous_location'];
It's important to set session.save_path in your PHP configuration file or your sessions might get lost.