Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

From form to ascii file

Status
Not open for further replies.

chomps303

MIS
Sep 30, 2003
83
US
I have a form on my SCO Unix box and I want to send the fields to a text file. How can I do that?
 
set up your html file to be accessible via a webserver that has CGI enabled.

<form method=post action=/cgi-bin/myscript.pl>
<input type=text name=fred></input>
<input type=submit>
</form>

perl script to reside in /cgi-bin/myscript.pl
Code:
#!/usr/bin/perl
#above is the shebang line issue which perl at the command line to see 
#where your perl actually resides

use strict;  #force good practice
use CGI;

my $query=new CGI;
my $fred=param('fred');

print $q->header;

open FH, ">>myfile.txt" or die "can't open output file $!";
print FH "fred is now $fred\n";
close FH;

print $q->start_html();
print $q->"fred is now $fred";
print $q->end_html();

Look up Lincoln Stein, CGI on google

HTH
--Paul


It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ... smack the fecker
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top