jibster Posted March 14, 2008 Share Posted March 14, 2008 Hi, quick question. So I have a form. I POST the variables to itself (PHP_SELF) then if validation is ok I send them to the next page. Now if they click the back button the values aren't re-populated. Is the way to repopulate by doing this? <input name="forenames" type="text" value="<? if(!empty($_SESSION['value_forenames'])) { echo $_SESSION['value_forenames']} ?>" /> Or is there a way to automatically "remember" what was in those fields. I'm sure this must have been answered before but my search didn't get any likely looking results. Cheers Quote Link to comment Share on other sites More sharing options...
soycharliente Posted March 14, 2008 Share Posted March 14, 2008 If you want them to be able to go back to the form and have it repopulate, I suggest you create a form on the next page with all the data that was posted in hidden field and give them a button to click that would simply repost it to that page. Quote Link to comment Share on other sites More sharing options...
jibster Posted March 14, 2008 Author Share Posted March 14, 2008 Good idea that. Except if they ignore my button and click back (as I am prone to doing) it's all over for that method isn't it. Thanks Quote Link to comment Share on other sites More sharing options...
soycharliente Posted March 14, 2008 Share Posted March 14, 2008 That's why you give it to them. As a favor. If they use your button, it works! Quote Link to comment Share on other sites More sharing options...
vicodin Posted March 14, 2008 Share Posted March 14, 2008 Store the variables in a session Quote Link to comment Share on other sites More sharing options...
Sulman Posted March 14, 2008 Share Posted March 14, 2008 The way you have done it (by echoing the session var in to the value field) is absolutely the way to do it! Quote Link to comment Share on other sites More sharing options...
jibster Posted March 14, 2008 Author Share Posted March 14, 2008 Thank you for your replies. I'm probably wrong but isn't there a way to do it using header("Cache-control: private"); ...or similar header. 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.