Solved

saving data on form submit

Posted on 2004-10-14
8
215 Views
Last Modified: 2010-04-09
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
Comment
Question by:ganatra
  • 3
  • 2
8 Comments
 
LVL 49

Expert Comment

by:Ryan Chong
ID: 12315454
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
 

Author Comment

by:ganatra
ID: 12315544
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
 
LVL 49

Expert Comment

by:Ryan Chong
ID: 12315808
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:ganatra
ID: 12319845
ryancys.. i am waiting for the code you said you will provide..
0
 
LVL 49

Accepted Solution

by:
Ryan Chong earned 25 total points
ID: 12326789
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
 
LVL 4

Expert Comment

by:sprisoner
ID: 12806843
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Create html table using xsl 8 28
Show banners that are blocked by Ad Muncher 10 48
Change text to radio button and calendar form 2 34
Wrapper for APPs 9 36
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now