We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

HTML form to a text document?

Arka3L
Arka3L asked
on
Medium Priority
179 Views
Last Modified: 2010-05-18
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.
Comment
Watch Question

Commented:
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:

<?php
$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));
fclose($fp);
?>

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.
-Sam
CERTIFIED EXPERT

Author

Commented:
Sam,

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.
Commented:
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.

-Sam

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Commented:
Arka3L,
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
Huji
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.