garyed Posted June 10, 2012 Share Posted June 10, 2012 I'm not sure if this is a php problem or not but here goes. I have an online program that consists of four php pages. Each page takes you to the next after your data is entered or selected until you get to the fourth page. That is where you get the final solution needed. The main reason I separated the pages was for looks so there wasn't too much to view or do on any one page. The problem is when you get to the last page & you enter all your data you can't change any selections from the previous page without losing all the data you just entered on the last page. There are about 50 different input boxes on that page too. The only thing I can think to do is to combine all the pages into one to solve the problem but that defeats my original purpose of separating the pages to begin with. Here's the link - http://www.loadcalc.net Any ideas welcome Quote Link to comment https://forums.phpfreaks.com/topic/263930-keeping-data-when-changing-php-page/ Share on other sites More sharing options...
HDFilmMaker2112 Posted June 10, 2012 Share Posted June 10, 2012 Use sessions to repopulate the input fields with the stored value in the session. <input type="text" name="" id="" value="$_SESSION['session_name']" /> When each page is submitted assign the $_POST to a session, and don't unset the sessions until all the data is finally submitted. Quote Link to comment https://forums.phpfreaks.com/topic/263930-keeping-data-when-changing-php-page/#findComment-1352567 Share on other sites More sharing options...
cpd Posted June 10, 2012 Share Posted June 10, 2012 You need to look at creating multiple boxes one being a "Save" button as opposed to "Save and Continue" or something like that. This way, the user can save the page and go backwards or forwards. Use a session to maintain the data whilst the user fills out the form as FilmMaker already suggested. I would unset that session once everything is complete as well. Quote Link to comment https://forums.phpfreaks.com/topic/263930-keeping-data-when-changing-php-page/#findComment-1352585 Share on other sites More sharing options...
PFMaBiSmAd Posted June 10, 2012 Share Posted June 10, 2012 You can also do this on a single page, but display your form in multiple steps on that page - http://www.dynamicdrive.com/dynamicindex16/formwizard.htm Quote Link to comment https://forums.phpfreaks.com/topic/263930-keeping-data-when-changing-php-page/#findComment-1352696 Share on other sites More sharing options...
garyed Posted June 10, 2012 Author Share Posted June 10, 2012 Thanks to everyone for the ideas, I'm going to read up on all these recommendations & see how things work. My programming skills are pretty weak. I'm just learning what I need to do on an as needed basis. Probably not the best way to do it but thank God for the internet. Quote Link to comment https://forums.phpfreaks.com/topic/263930-keeping-data-when-changing-php-page/#findComment-1352703 Share on other sites More sharing options...
garyed Posted June 10, 2012 Author Share Posted June 10, 2012 You need to look at creating multiple boxes one being a "Save" button as opposed to "Save and Continue" or something like that. This way, the user can save the page and go backwards or forwards. Use a session to maintain the data whilst the user fills out the form as FilmMaker already suggested. I would unset that session once everything is complete as well. Right now I'm using: <input type="text" name="window" value="<?php echo $_POST['window']; ?>" > to keep the data in the fields when the page is submitted. Wouldn't I have to still use the php tags to use $_SESSION ? Quote Link to comment https://forums.phpfreaks.com/topic/263930-keeping-data-when-changing-php-page/#findComment-1352707 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.