How do I go back in the browser in PHP?

You can use javascript to back a page: history.go(-1)

Eg:

Code:
<a href=”#” onclick=”history.go(-1)”>Back</a>

Or you can use PHP code to determine which page they came from and create link like:

Code:
<a href=”<?=$_SERVER[’HTTP_REFERER’]?>”>Back</a>

Posted by Suresh B

Leave a Reply

You must be logged in to post a comment.