HTML form to a text document?

Hey guys,

I hope someone can point me in the right direction.

I need to know if it's possible to create an html page form, laid out with text fields and text boxes. Once the user inputs information in these fields, is it possible for a submit button to process this information and lay it out in any form of a text document for records?

I have quite a broad understanding of html, and i know its possible to send emails, but i've never heard or come across this before. It needs to be totally dedicated as otherwise i would script something in php.

Thanks for your help.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Would help to know what server side language you're using (php/asp/VB/etc).

A quick php example assuming you have Name: Phone: Comments:

Have your form action run a php script like this:

$filename = //put the filename to write to here
$name = $_POST[currentFile];
$phone = $_POST[newText];
$comments = $_POST[prefix];
$textToWrite = "$name\n$phone\n\n$comments";
$fp = fopen($filename, "a") or die("Can't open $filename try again later");
fwrite ($fp, stripslashes($textToWrite));

I'm not sure what the equiv in VB/ASP/.NET would be, but sure you could find it easy enough if you need it.
Arka3LAuthor Commented:

Thanks for the effort, but please read my question more clearly. I'm asking if its possible to do it in html, also i stated that I need to be able to do this without running any server.

Is it possible, yes or no, for a user to create a form made in html format, that will post the inputted information to a text document. If you can make emails, surely there is a way to post to a text file.
No, there is no way to do that with html alone.  You have to use a server side language to access and write to files.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
There is no doubt you need to use a server-side code for it. However, if your only concern is the form to be a .html file, then you can get around this. You can tell your web server (for example IIS) to process the .html files as if they were .php files. For that, you must go to Control Panel > Administrative Tools > Internet Information Services. Then you should browse to your web site, right click its name, choose Properties, Press the "Configuration..." button , press Add button, and fill the form like this:

Executable: (here you should browse to the PHP engine, it is possibly in C:\PHP and its name is php-cgi.exe if you are using the CGI version, or php5isapi.dll if you are using PHP 5 i ISAPI mode. If you have problem with this step, I can help you on your request.)
Extension: .html  (or  .htm  if you prefer)
All vers (selected)
Limit to: (dont select it)
Script engine (checked)
Check that file exists (no need to check it)

And press OK. Then paste the php code inside the html file but save it as pagename.htm and then test it online.
Hope it helps
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.