I'm doing research on internet behavior. The participants of my study are asked to fill in a questionnaire.
- What they don't know is that this questionnaire consists of an infinite series of forms:
- whenever they submit one form, they are presented with another one. From their perspective, the questionnaire never ends. It is filled from an array containing thousands of random questions from old studies.
I want to test, how long different users keep going.
I have two options:
Save each form to the database, when it is submitted. Each successive form
UPDATE
s the same data record with the current page count. This is easy, and I know how to do it.-
No data is saved while the user performs the task. The current page count is saved from the
SESSION
, when the user abandons the task, i.e. when he closes the browser window.How do I do this? How can I tell PHP to save a
$_SESSION
variable, when the user closes the browser? Is this even possible in a reliable way, i.e. the solution does not rely on functionality that is not available in all browsers, such asonbeforeunload
(which does not work in Opera)?