在PHP / Javascript中调用浏览器后退按钮

I have a form which sends the user to a different form incase they don't complete it to go back to the form and complete anything that was missed. Now unless the user presses the browser back button the page is loaded fresh which mean any data gets lost.

Pretty much when they come back to the previous page, anything they already filled in should stay intact.

I have the following two pages:

Page 1:

<?PHP

echo "<a href='page2.php'>NEXT</a>";
echo "<input type=text size=25 name=txt />";
?>

Page 2:

<?php
$refer = $_SERVER['HTTP_REFERER'];
$lastlink = "<a href='$refer'>BACK</a>";

echo $lastlink;
?>

On page two if i click BACK to come back to page 1, anything entered in page 1 will be lost which I do not want. How do I work around it without using Javascript? with Javascript? I know in javascript I can use

<a href="javascript:history.go(-1);">BACK</a>

But is there another way?

Take a look at html5 history api. History api + ajax is great combination

I am usually satisfied with:

history.back(-1);

Sending back to a previous page using Server-Side logic, is not a good approach to do, so I will disencourage it.

You can also use a session to store $_POST on submit and check if it is set on page-load of the first form.