> > Jim Moseby wrote: > >>-----Original Message----- > >>From: Jack Jackson [mailto:jackson.linux@xxxxxxxxx] > >>Sent: Wednesday, July 27, 2005 3:47 PM > >>To: php >> "[php] PHP General List" > >>Subject: Re: Multipage form redux > >> > >> > >>hi, my first attempt at a sessions-based form is starting at > >> > >>http://pastebin.com/322696 > >> > >>and I have a question. What I want to do is, after the user > >>answers the > >>questions in section one and they are error checked, I want > >>to write the > >>answers to $_SESSION() and then continue down the script to > the next > >>page of questions. I do *not* want to re-send the answers > >>from page one > >>as $_POST vars back to the user and have the user submit the > >>answers to > >>page 2 plus the $_POST answers from page 1. > >> > >> > >> > >>What I am doing now is clearly wrong, basically : > >> > >>if (empty($error)) { > >> include_once($page2); > >>} > >> > >>because that's keeping it all in one script. But how should I > >>be getting > >>to the next page, sending headers to a new script, and at the > >>end of the > >>chain the script which pulls it all together? > >> > >>Thanks in advance, > >> > >>JJ > > > > > > > > This seems so simple to me. As I understand it, you want > to split a data > > entry session into several pages. You don't want to > collect the data and > > submit it all at the end, but instead commit it to session > variables along > > the way. Am I missing something? > > > > Here's how I would do it in a nutshell: > > > > Page1 // User enters first batch of data, presses SUBMIT at > bottom. Data is > > POSTed to Page2 > > > > Page2 // Commit data from page 1 to session variables, then > displays form > > for next batch of data. User presses SUBMIT, posts data to Page 3. > > > > Page3 // Commit data from page 2 to session variables, then > displays form > > for next batch of data. User presses SUBMIT, posts data to Page 4. > > > > ... etc etc etc (Each page begins by assigning data from > the previous page > > to session variables) > > > > Page515 // Displays all session variables set in previous > pages, asks user > > to confirm. User confirms by pressing SUBMIT, confirmation > POSTed to page > > 516, who writes it all to the database, and sends > confirmation email. > > > > Personally, I would take the advice of a previous poster > and start off > > assigning a username and password to the user. Then store > each page in the > > database as the user progresses. That way, if he is > interrupted in the > > middle of the process, he won't lose all his data and have > to start over. > > He can just enter his username and pick up where he left > off. You will just > > have to write a script that purges old incomplete records. > (A great job for > > cron!) > > > > JM > > > > > Right. Except I would rather have it working in a session because I > specifically do not want to have the form sending $_POST data > back and > forth to the browser six times for several reasons. SO I'd like to > > Page1 // User enters first batch of data, presses SUBMIT at bottom. > Data is cleaned and written to SESSION, user passed to Page2 > > repeat as necessary to last page. At last page, process and > error check > newest input, then commit it, plus all previously stored > session info to > db. > > Does this make sense? > > Thanks in advance Makes sense. I do not believe you can do this without client-side scripting (Javascript, AJAX, etc) You cannot (otherwise)process data that has not been sent back to be processed. JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php