• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 225
  • Last Modified:

saving data on form submit

Hi,

Can i write the data input in the html form fields to a text file...  like take the example of a quiz, the user takes a multiple choice answers quiz and i want to save the answers he chooose to a text file..  is it possible in simple html  or do i need to use asp or some scripting language..

plz reply now..


regards,.

0
ganatra
Asked:
ganatra
  • 3
  • 2
1 Solution
 
Ryan ChongCommented:
Is the file generated saves to local or at server?

You definitely need to use server side scripting language (like asp you mentioned) if you want to save the content at server.
0
 
ganatraAuthor Commented:
i was wonder if i dont use a server.. and do it locally.. is there any java script that let me do this..  if not can u provide me with some good link of the asp code that writes form data to a file..

i'll be grateful..

regards,...
0
 
Ryan ChongCommented:
You probably need use Java Applet instead, as javascript is not capable to save file locally.

I will provide you the asp code to save content as file shortly.

cheers
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
ganatraAuthor Commented:
ryancys.. i am waiting for the code you said you will provide..
0
 
Ryan ChongCommented:
Sorry for the late response, ganatra.

To save the form content to a file, you can try like:

<%...
Dim fso, MyFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.OpenTextFile(Server.MapPath(".") & "testfile.txt", 8, True)

For Each i in Request.Form
  MyFile.WriteLine i & ": " & Request.Form(i)
Next
MyFile.Close
%>

then try to access the testfile.txt.

Original code by Yury_Delendik can be found at: http:Q_10307945.html

Another useful example at:
http://www.w3schools.com/asp/met_opentextfile.asp

More info regarding FSO in ASP can be found at:
http://www.w3schools.com/asp/asp_ref_filesystem.asp

Hope this helps
0
 
sprisonerCommented:
ryancys is write...good coding of course. What it does is reads the requested form line by line and writes to a text created by FSO. So, an important issue is to make sure that u have nothing extra in the requested form than the required data...because whatever it be, will get written to the text file. Be careful with this.
Nash
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now