I am looking for a script or method of storing the data a user inputs
in our surveys (forms with 50-100 questions) in a cookie and then if
the user has to leave they can come back and the answers will
automatically be repopulated.
Currently this is a cumbersome process as I have to assign a value to
each form element, I was hoping to get something that would do it
automatically so I can apply it to all of the forms.
Thanks.
Hi.
I would suggest taking a different route, and using server-side
technology to store the information. If I remember correctly, cookies
are limited to about 4KB in size, each, and you usually won't see an
error when you exceed this limit. Also, I believe this limit varies
from browser to browser. Generall, most browsers only allow up to 300
cookies to be in storage at any one time. If the user clears their
cookies in the meantime, or happens to visit 300 fresh sites before
going back to yours, the information will be lost. Also, the
information stored in the cookies will be sent to your site with each
user retreives a page from your website. For users on dial-up, sending
4KB of cookies will take a very long time indeed.
The only other options you really have, would be to use a session (if
your server supports PHP). This relies on a cookie, and unless changed
from the default only keeps a stored session for 24 hours. Also, you
can use a database, but this would again rely on the user not having
deleted their cookie for your site, and it would be down to you to
manage when data is removed from the database, and how long it's kept
for.
If you used a database, you could easily link information to a user's
IP address. The catch here is that there can be more than one user on
a particular IP address, and also, this poses problems for users using
proxies. I think the best way to store user specific information, is
to use a website login. Not always convenient, but a darn sight more
reliable and secure.
Just my two cents.
Daz.