dazzclub Posted June 10, 2010 Share Posted June 10, 2010 Hello there, Im trying to get my head around sessions and passing the data between pages. So I'm attempting to build a very basic questionnaire. My problem comes when i try to go back to a previous page. I want the user to be able to go back and change their answers if need be. This is the code taken from page one. <?php session_start(); //sends enquiries //page 1 answers $_SESSION['day_1_fridge_indicator'] = $_POST['day_1_fridge_indicator']; $_SESSION['day_2_fridge_indicator'] = $_POST['day_2_fridge_indicator']; $_SESSION['day_3_fridge_indicator'] = $_POST['day_3_fridge_indicator']; ?> and on the second page it looks like this; <?php session_start(); //sends enquiries //page 1 answers $q1 = $_SESSION['day_1_fridge_indicator']; $q2 = $_SESSION['day_2_fridge_indicator']; $q3 = $_SESSION['day_3_fridge_indicator']; ?> If you want a working demo then please visit here >> http://www.lcrhallcrest.com/bmpa-survey/ Thanks for any type of help would be great. Quote Link to comment Share on other sites More sharing options...
jonsjava Posted June 10, 2010 Share Posted June 10, 2010 a simple method would be to add this to the top of your first page: header("Cache-Control: private, max-age=10800, pre-check=10800"); header("Pragma: private"); header("Expires: " . date(DATE_RFC822,strtotime("+1 hour"))); // Change this to how long you are willing to have them go back 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.