When people registrate and get an error, they have to re-enter all information when they go back.
See http://ac-auction.com/register.php if you don't know what I'm talking about.
How can I make it so that all the info doesn't dissapear?
Keeping entered details when pressing BACK button
Moderator: General Moderators
One way of doing it is by session
Set all fields to something and then store them into session and read from it.
Code: Select all
<?php
session_start()
if(isset($_SESSION['form_field'])
$form_field=$_SESSION['form_field'];
}else $form_sield='';
?>
<form ...>
<input type="text" name="form_field" value="<?php print $form_field ?>">
...i think it depends on what vesion of IE and what IE you use that keeps the info when you press back.
i believe (not tested) is that you can use header() command to go back to the login page with the entered info in the url and using $_GET to display the info back in the form like
HANDLEREGISTER.PHP
(if headers were sent already for some reason you could use ob_Start
http://php.planetmirror.com/manual/en/f ... -start.php)
REGISTER.PHP:
like i said i got no idea if this works cos im pritty new to this stuff and its only a theory.
EDIT: or do what he said above
wow took me so long to post this lol.
i believe (not tested) is that you can use header() command to go back to the login page with the entered info in the url and using $_GET to display the info back in the form like
HANDLEREGISTER.PHP
(if headers were sent already for some reason you could use ob_Start
http://php.planetmirror.com/manual/en/f ... -start.php)
Code: Select all
$oldvalue = $_POST['oldvalue'];
$value = "value=" . $oldvalue . "";
header("location:register.php?$value");REGISTER.PHP:
Code: Select all
<?php
$value = $_GET['value'];
echo '<input type="text" name="test" size="25" value="$value>"';
?>EDIT: or do what he said above
Code: Select all
-
dyonak
- Forum Commoner
- Posts: 56
- Joined: Wed Jun 22, 2005 10:22 am
- Location: Minneapolis, MN
- Contact:
Add the following line of code to your page(s), this assumes you already have a session_start(); call and should be added directly after it.
Some good information on sessions - http://www.phpfreaks.com/tutorials/41/0.php.
Code: Select all
header("Cache-control: private");Thx, simple solutions r always bestdyonak wrote:Add the following line of code to your page(s), this assumes you already have a session_start(); call and should be added directly after it.Some good information on sessions - http://www.phpfreaks.com/tutorials/41/0.php.Code: Select all
header("Cache-control: private");