[PHP] working with forms - loosing data on back button
Hi there, I am trying to make a php powered text publishing process more user friendly. The problem I have, is that the publishing is split into 3 screens (steps). If the user reaches form 2, types something in and clicks on back and then on forward again he looses the values of the data entered in form 2. The back button is done with: javascript:history.back(); so it is totally clear that the value of the present form is gone. But how to put two different actions into one form? One for next, one for back? Do you see the problem? I would like to avoid saving to a database before the user does not finish the whole process. There must be another solution. I guess this is a standard problem and I do just not see the solution?! Thank you for any help, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] working with forms - loosing data on back button
Merlin, I have a similar problem right now. After a little research, I can offer the following solutions: 1. Save the data to a temporary table with a timestamp -- then run a process via cron (or manually) to clear out old, unfinished forms, without worrying about your real data. 2. Save the form contents of each step into a session on the server side... they can skip backwards and forwards as much as they like, with the form populated with existing SESSION data on each load. Once they're happy, the click Save, and the whole lot is added to the DB. 3. Just put the whole form onto one page, not three. 4. As per #3 (it's only one page of HTML), but use some cleaver CSS JS to hide/show parts of the form as some form via a tabbed interface. Personally, I'm going with #4, but have used #1, 2 3 before as well. After reading an excellent article at A List Apart on this very topic, I can honestly say It's really simple (providing you have some knowledge of CSS DOM). Best still, it's completely accessible to users without JS (they see all 3 parts at once), really light weight, and really simple to implement. http://www.alistapart.com/articles/eatcake/ Justin On 11/05/2004, at 4:17 PM, Merlin wrote: I am trying to make a php powered text publishing process more user friendly. The problem I have, is that the publishing is split into 3 screens (steps). If the user reaches form 2, types something in and clicks on back and then on forward again he looses the values of the data entered in form 2. The back button is done with: javascript:history.back(); so it is totally clear that the value of the present form is gone. But how to put two different actions into one form? One for next, one for back? Do you see the problem? I would like to avoid saving to a database before the user does not finish the whole process. There must be another solution. I guess this is a standard problem and I do just not see the solution?! --- Justin French http://indent.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] working with forms - loosing data on back button
From: Merlin [EMAIL PROTECTED] The problem I have, is that the publishing is split into 3 screens (steps). If the user reaches form 2, types something in and clicks on back and then on forward again he looses the values of the data entered in form 2. The back button is done with: javascript:history.back(); so it is totally clear that the value of the present form is gone. But how to put two different actions into one form? One for next, one for back? Do you see the problem? I would like to avoid saving to a database before the user does not finish the whole process. There must be another solution. I guess this is a standard problem and I do just not see the solution?! Save it into the session as they go through the three pages and only save it into the database at the end. Keep track of a $page variable and increment or decrement based on whether they chose the Next or Prev button and show the appropriate content for the $page. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php