Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

When we press the back button the form values are lost

Status
Not open for further replies.

amir4oracle

Programmer
Nov 3, 2004
46
CA
How can we retain the values for textarea, radio buttons, check boxes, select option drop down etc in a form? Because when we press the back/forward buttons the values are lost.

Your help is highly appreciated. Thanks in advance.
Best regards,
Amir
 
values are lost
that's surprising. usually the user agents resend the data.

but you can secure it at the server side using sessions
 
Ya, store the data is session variables, and have your form populate from those variables automatically if they are set. as in:
Code:
<?php
$_SESSION["example"] = isset($_POST["example"]) ? $_POST["example"] : "";
?>

<form method="post">
<input type="text" name="example" value="<?php echo $_SESSION["example"] ?>" />
</form>

Check out my blog: defrex.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top