views:

19

answers:

2

I'm building a simple survey, consisting of several pages with questions that all have multi-choice answers: radio buttons and checkboxes

The end result required are records in a MySQL table, one for each answer selected.

And we want to make it so that you can quit halfway through and come back later to complete.

My first thought was to simply save to the database (via AJAX) on every click of a checkbox/radio button.

But I'm worried about performance and load on the server. However the only alternative is to save to a session or JS array then save them when they click 'next'. This isn't as ideal but would be much lesser load.

Any suggestions?

A: 

If you require user login for this application, you can go ahead with storing it in the Database. MySQL is fast anyway since your just storing minimal amount of data.

Your data would look like,

username: user
survey_id: 1
answers: 1,3,5,6,3,7,3

If you don't require user login, you can store his activity in a file for each IP. then you can just have a daily cleanup for these files. (that is if you don't want to store it in the database. The difference would be minimal though. Depending on the geological positions of your DB and WebServer)

sheeks06
A: 

Depending on your back-end, saving data in sessions so users can continue where they left off may or may not have a profound difference from saving data as each question is answered, be it an AJAX call or a new HTML page being displayed. This relies heavily on your hardware, bandwidth, operating environment and your session handler.

stillstanding