snow Posted September 12, 2007 Share Posted September 12, 2007 Hi can someone simply explain how I can use hidden form elements so I can keep variables for later on. For example: Web Page 1 (Has the forms) --> Web Page 2 (gets $_POST) --> Web Page 3 now has lost all the post data from page 2, how do I keep it so I can re-use it? I'm new at php and any help would be appreciated, preferrably simple methods! Thanks heaps in advance! Link to comment https://forums.phpfreaks.com/topic/69032-solved-hidden-form-elements/ Share on other sites More sharing options...
micah1701 Posted September 12, 2007 Share Posted September 12, 2007 use sessions put: session_start(); at the top of each page. then you can pass variables from page to page in your code by assigning them to the session array. page 1: <?php session_start(); $_SESSION['var1'] = "some data"; ?> page2 or 3 or 4 or whenver you want as long as the person keeps there browser open and comes back to your site: <?php session_start(); echo $_SESSION['var1']; ?> Link to comment https://forums.phpfreaks.com/topic/69032-solved-hidden-form-elements/#findComment-347019 Share on other sites More sharing options...
snow Posted September 12, 2007 Author Share Posted September 12, 2007 Thank you. But does this work for forms? Should I do this on the post page of the form: $_SESSION['day'] = $_POST['day']; $_SESSION['time'] = $_POST['time']; $_SESSION['delivery'] = $_POST['delivery']; Link to comment https://forums.phpfreaks.com/topic/69032-solved-hidden-form-elements/#findComment-347031 Share on other sites More sharing options...
snow Posted September 12, 2007 Author Share Posted September 12, 2007 Oh I got it working, thank you very much! Link to comment https://forums.phpfreaks.com/topic/69032-solved-hidden-form-elements/#findComment-347032 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.