[PHP] when to enter submitted in mysql?
Hi to all! I have form made on 4 pages (by groups of questions). Right now my code works this way: once somebody submit the first page of the form his/her submitted info is entered in database with status=temp. I store the ID (insert_id()) in session and then every time visitor submit the next page I do update of the current record using ID. But, I heard once that the best solution is store all entered info in session (array) and insert all info at once. Or, instead in sessions, move submitted info with serialized array. Opinions? Thanks for help. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] when to enter submitted in mysql?
Hi to all! I have form made on 4 pages (by groups of questions). Right now my code works this way: once somebody submit the first page of the form his/her submitted info is entered in database with status=temp. I store the ID (insert_id()) in session and then every time visitor submit the next page I do update of the current record using ID. But, I heard once that the best solution is store all entered info in session (array) and insert all info at once. Or, instead in sessions, move submitted info with serialized array. Opinions? The upside to storing the data in session variables is that you make only ne DB call at the end, saving processor, bandwidth, etc. The downside is, that if your user cannot complete the form, his data is lost and he has to start all over again. Which one is best depends greatly on your environment and situation. For instance, if you have 1000 users onlin simultaneously filling out forms, and the forms are simple, you would probably opt to use session variables and make one DB call. If you only have one or two online and the forms are 1000 questions long, your would want to write each page as it is completed. JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] when to enter submitted in mysql?
Personally, I'd keep it all in the session and write at the end, but this approach has at least two drawbacks: 1. The user cannot complete the process at a later point. 2. You cannot conduct analysis of part-completed data. Cheers, David Grant [EMAIL PROTECTED] wrote: Hi to all! I have form made on 4 pages (by groups of questions). Right now my code works this way: once somebody submit the first page of the form his/her submitted info is entered in database with status=temp. I store the ID (insert_id()) in session and then every time visitor submit the next page I do update of the current record using ID. But, I heard once that the best solution is store all entered info in session (array) and insert all info at once. Or, instead in sessions, move submitted info with serialized array. Opinions? Thanks for help. -afan -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] when to enter submitted in mysql?
On Tue, Nov 29, 2005 at 11:57:49AM -0500, Jim Moseby wrote: Hi to all! I have form made on 4 pages (by groups of questions). Right now my code works this way: once somebody submit the first page of the form his/her submitted info is entered in database with status=temp. I store the ID (insert_id()) in session and then every time visitor submit the next page I do update of the current record using ID. But, I heard once that the best solution is store all entered info in session (array) and insert all info at once. Or, instead in sessions, move submitted info with serialized array. Opinions? The upside to storing the data in session variables is that you make only ne DB call at the end, saving processor, bandwidth, etc. The downside is, that if your user cannot complete the form, his data is lost and he has to start all over again. Another upside is that you dont have to maintain old session data, it is done for you. If the user comes to your site and just does 3 of the 4 pages, you dont have to worry about cleaning up any extra dead information. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php