IF there is a previous page to go back to it Might be in $_SERVER['HTTP_REFERER']. Of course that will only work once unless you want to record every page the user visits in order, in which case you have an array of all the pages visited, in order, with each new URI added to the end as it's visited, and the "back button" is a link to the second-to-last entry in that array (the last entry being the current page).
Of course, then you'll need to drop the last entry off the array so that the previous page becomes the current page that's listed last on the list (and each time you visit a page you'll have know that the user got there by push the "back button" instead of going there directly, so instead of containing the link in the back button directly, it may need to be a link to a distinct back-handling page, with an id number in the query string to say which array index contains the link to go back to, and then that back-handling sends a redirect to the browser with the real back link ... of course, that doubles the number of requests needed for a page, slowing the site down, so that's probably not a great idea.
It's a lot of work to go to to replicate the browser's own page history functionality - and it's own back button. Especially since the browser's is more powerful because it's not limited to a single site.