php multi page form back button?

Jason

New member
i have a multi page form using php on my site. after filling in each page the user clicks 'next' and all the data is submitted at the end to my email. i would like to make a back button so the user can go back a step to change details. i cant work it out without the data being deleted when moving backwards. thanks!
 
You have to pass the paramaters back, probably using POST. Assuming you're using a form, then basically all your form fields (textboxes etc) will have names and you simply POST them when you click back and then have the fields echo the value of the post.

So if you had a form:

<form action="process.php" method="post">
<input type="text" size="25" name="searchtype" />
<input type="text" size="25" name="searchterm" />
</form>

You could grab the values like this:

$searchtype = $_POST['searchtype'];
$searchterm = $_POST['searchterm'];

And then you could also display them on the back by changing:

<input type="text" size="25" name="searchterm" />

to:

<input type="text" size="25" name="searchterm" value=" <? echo($searchterm) ?> " />

Hope this helps!
 
Back
Top