How to get the previous page in php

Imagine how this works, your in and then you go to, question is how would you get the url of

It’s easy, just use


In this way, you can get the url of the previous page.
The $_SERVER is a pre defined variable that has lots of useful information, you can just check it out when you do


Hope this helps someone!
Have a happy coding! :)