Opinion needed: SESSIONS or tables?

I’m building a multi-page form that will have about 30 fields (or more, depending on user input). I’ve currently set it up so that every time the submit button is pressed all of the data is stored in a SESSION so the user can go back and forth through the form and no data is lost.

I’m starting to rethink this, as the site is getting rather busy and the SESSION overhead may be too much. I’m thinking about going down the path that Tumblr is on. Apparently (please correct me if I’m wrong) they save everything in a table so that nothing is lost, even if you abandon the form without clicking on submit, the data is saved.

My users have to register before they can fill out the form, so it’s easy for me to assign the data to a user, should they abandon the form. This way they can always return to it and complete it later, or delete it.

I’m thinking I would just INSERT all of the data into the database with it flagged something like ‘editing’ so that it doesn’t appear on the rest of the site until it’s set to ‘published’. I could also set up a cron job to delete any entries that are over 10 days and not published.

What are your thoughts on this? Do you know how Tumblr does their magic? Do you know how they save everything without even clicking on submit?

Thanks!

Due to this facility
"My users have to register before they can fill out the form, so it’s easy for me to assign the data to a user, should they abandon the form. This way they can always return to it and complete it later, or delete it.
"
I think you idea of DB is good.

Stick with the session method. If you want to save the information if the user close’s the browser look into saving the information in a cookie instead.

Here is one way:

  1. Set the cookie
  2. Make it into an array
  3. Push the information into the array as the user goes through each page
  4. When the user reaches the last page, format the array and INSERT into a database.

I failed to mention that at one point there is an option for uploading images.

I got the impression that on tumblr everything is just one huge page, they just show/hide various divs that you fill in.

When you press save then you save all the info in all the divs you may have filled in.

If so, then thats an old trick that works well.

I would save everything in the database, as soon as the user provides the information (especially if they upload images…).

That way, if they provided an email and x/y/z fields, you can pass them a few mailers in a few days, urging them to finish the registration process.

The only “problem” you will have is that you will have incomplete profiles, since allot of your users will give up registration midway. So you either live with it, or purge them from time to time.

You could always override the way your session handling works to store it all in a table in a database if you think that will be more efficient. Then no changes to the pages themselves would be required.

On my Tumblr dashboard I can, for instance, click on “Photo” to add a new photo. When I do I go to a new page that will allow me add a photo and text. I can assign a photo, add some text and, without clicking SUBMIT, open a new browser window, go to my Tumblr dashboard and it will tell me I have an unsaved post. I’m not sure how they do that.

I’m not sure what you mean with the divs.

They’re already registered.

I was taking a guess that the concept of “pages” is masked by divs whose css display is set to hidden unless you activate one, in which case that one becomes visible, and all the others are hidden again.

The uploads and saves are probably Ajaxian in nature.

That’s my guess too, although wouldn’t that be incredibly expensive? I mean, right when I start typing it’s saved. YBH305 had a good idea about cookies. Perhaps that’s what they’re doing instead of saving it into a db…

EDIT: Yep. I just checked. Tumblr is storing the posts in cookies under the name rescued_post.