evon83 Posted September 24, 2006 Share Posted September 24, 2006 This is my sample code:Page1:<?php session_start();?> <form action="session2.php?" method="Post"> <table align="center" border=0 cellspacing=5 cellpadding=0 width="100%"> <table> <tr> <th align="left">Address :</th> <td><input type="text" size = "55" name="address1"/></td> <td><input type="text" size = "55" name="address2"/></td> </tr> </table> <center><input type="submit" name="submit" value="Submit"><input type="reset" Value="Reset"/></center> </form>page2:<?php// page1.phpsession_start();$_session['address1']=$_POST['address1'];$_session['address2']=$_POST['address2'];echo "1:".$_session['address1'];echo "2:".$_session['address2'];session_destroy();-------------------------------------------my question is:after i have clicked on page2....i wanna go back to page1, so click on the back button...and when i do that, the data that i have keyed in previously has been erased automatically....how to keep my previous data??please help!thanks! Quote Link to comment Share on other sites More sharing options...
sanfly Posted September 24, 2006 Share Posted September 24, 2006 Try Thisheader("Cache-control: private");[quote]<?php session_start();[color=red]header("Cache-control: private");[/color]?> <form action="session2.php?" method="Post"> <table align="center" border=0 cellspacing=5 cellpadding=0 width="100%"> <table> <tr> <th align="left">Address :</th> <td><input type="text" size = "55" name="address1"/></td> <td><input type="text" size = "55" name="address2"/></td> </tr> </table> <center><input type="submit" name="submit" value="Submit"><input type="reset" Value="Reset"/></center> </form>page2:<?phpsession_start();[color=red]header("Cache-control: private");[/color]// page1.php$_session['address1']=$_POST['address1'];$_session['address2']=$_POST['address2'];echo "1:".$_session['address1'];echo "2:".$_session['address2'];session_destroy();[/quote] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.