Save html-forms data to local disk?

G

grz02

A question on html-forms:

We have an application where users will get a CD with,
among other things, some html-forms for them to fill in.
When they click the submit-button, the data is transferred
to a webserver php-script that will then process the info.
The forms-definition looks something like this:

<form action="http://www.ourdomain.com/receiver.php" method="post">
<p>Question 1:
<p><textarea name="reply01" cols="40" rows="5"></textarea>
<p>Question 2:
<p><textarea name="reply02" cols="40" rows="5"></textarea>
<p>Question 3:
<p><textarea name="reply03" cols="40" rows="5"></textarea>
... etc ...
<p><input type="submit" value="Submit answers!">
</form>

Now, my concern is (since there might be quite a lot of data filled in),
if e.g. the internet-connection for some reason is broken
at the moment when the user clicks the submit-button,
there is a risk they will lose all the text and would have to re-type it,
which I would like to avoid, of course.

How can I best solve this issue?

Ideally, I would like to store the info on their local C: drive
before submitting, and automatically retrieve the text if they
later return to the page, but I guess that's not possible from
an html doc, right?

If so, any other suggestions how to resolve this issue?

TIA,
 
T

Toby A Inkster

grz02 said:
Ideally, I would like to store the info on their local C: drive
before submitting, and automatically retrieve the text if they
later return to the page, but I guess that's not possible from
an html doc, right?

Kind of possible. You could use JavaScript to save info to a local cookie.
 
G

grz02

Thanks for hint, seems like cookie would do the trick then...

Unfortunately, I dont have much experience w client-side scripting,
could someone please provide or point me to some sample-code
I could elaborate on here?

Thanks,
 
G

grz02

Found some very helpful code here:
http://www.echoecho.com/jscookies02.htm
so that problem is basically solved now.

But just realized I have a follow-up Question:

By experiment, it seems if I have two different
html-docs in the same local directory, say c:\dir
they will share the same cookie-string.

But if I have two html-docs in different local directories,
say c:\dir1 and c:\dir2 , they will have different cookie-strings
stored independently.

So the Question now is:

Is there any way to define a "global" cookie that will
be shared by all documents stored on the local drive,
regardless of the different directory-paths?

And where can I find some documentation that describes
such implementational details?

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top