Do you need to do this in PHP? You can do this in java, for example to create a back button:
<font face="Times New Roman">
<form> <p><input type="button" value="Go Back" name="BackButton" onMouseOver="'Go Back to Previous Page'; return true"
onClick="history.back()"></p> </form>
etc. etc... hope that gets u started.