Solved

saving data on form submit

Posted on 2004-10-14
8
222 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
8 Comments
 
LVL 52

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 52

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
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 

Author Comment

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

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
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…

696 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