Solved

saving data on form submit

Posted on 2004-10-14
8
219 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 50

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 50

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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

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

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

808 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