Solved

Form Submit to Text file

Posted on 2003-11-08
3
267 Views
Last Modified: 2010-04-06
Hello, I have a web page that has several drop down boxes. I would like to have a form that submits the selections in these dropdowns to a text file or html file.  

I do not have a real web server available for this (small office info page) so cant use ASP.

I would like each new entry to be appended to the file rather than have a new file created. Can someone lead me in the right direction here? Im not much of a web programmer and am not sure where to start (or if this is possible)

Thanks
0
Comment
Question by:Zakoriz
3 Comments
 
LVL 11

Accepted Solution

by:
Zontar earned 34 total points
ID: 9708842
If you're using any favour of Windows (except maybe for ME or XP), you can install either IIS (NT/2000)  or PWS (9X) and so have Active Server Pages.

Apache is also available for Windows and runs on any version of it. You can't run ASP on Apache, but you can run PHP no problem.

In either case you don't need a special machine just to run a Web server. You can do that on your desktop machine.

But you can't use Web page forms to add info to a DB or a file without a web server of some sort, so you'll need to get that issue resolved first.

A little more info about your circumstances would be helpful.
0
 
LVL 6

Assisted Solution

by:aolXFT
aolXFT earned 33 total points
ID: 9710265
Hmmm,

This will require a bit of engineering.

From your post, I'm assuming that the text file is actually on your own machine. Therefore it might be concevable to use client-side technology to do the job for you.

I'd consider looking into ActiveX, if you are using Internet Explorer, or java, if you have that enabled.

Check out http://forums.devshed.com/t605/s.html and http://www.nigelrivett.net/DTSActivexFileExists.html

or make a post in the Java/ActiveX sections of this site.
0
 
LVL 15

Assisted Solution

by:VincentPuglia
VincentPuglia earned 33 total points
ID: 9723249
Hi,

presuming you have a Windows environment:

<html><head>
<script language='javascript' type='text/javascript'>
<!--
function sendit(formObj)
{
  var fso, ts, s, stuff;
  var ForAppending=8;
  var txtFile = formObj.d.value;

  var stuff = new Array();
  stuff[0] = formObj.b.name;
  stuff[1] = formObj.b.options[formObj.b.selectedIndex].value;
  stuff[2] = formObj.c.name;
  stuff[3] = formObj.c.options[formObj.c.selectedIndex].value;

  fso = new ActiveXObject("Scripting.FileSystemObject")
  ts = fso.OpenTextFile(txtFile, ForAppending)

  for (var i = 0; i < stuff.length; i++)
      ts.WriteLine('Element ' + stuff[i++] + ' = ' + stuff[i]);
  ts.Close()
}
//-->
</script>
</head>
<body>
<form name="a">
<select name='b'>
<option>select</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
<select name='c'>
<option>select</option>
<option value="a">1</option>
<option value="b">2</option>
</select>
<input type="file" name="d">
<input type='button' onclick='sendit(this.form)'>
</form>
</body>
</html>

Vinny
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

744 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

14 Experts available now in Live!

Get 1:1 Help Now