PDA

View Full Version : form info needed please


chaotic
07-24-2002, 05:54 AM
how do i get this to save the data to a text file please :thumbsup: =


use CGI;

$q = new CGI;

print $q->header;

if ($q->param()) {
print $q->start_html("Results");
print $q->h2("Results");
print "Here's what you entered:<p>\n";
print "Your Name: ", $q->param("name"),$q->br;
print "Email: ", $q->param("email"),$q->br;
} else {
$q->start_html("Post Form");
}

print $q->start_form(-action=>"test.cgi");
print "<pre>\n";
print " Your Name: ",$q->textfield(-name=>"name"), "\n";
print " Email address: ",$q->textfield(-name=>"email"), "\n";
print "</pre>\n";

print $q->submit(-value=>"Send"),
$q->reset(-value=>"Clear Form");
$q->end_form;

$q->end_html;

Astro-Boy
07-25-2002, 12:59 AM
Something along the lines of:

open(TXT,'>/path/to/file.txt') or die $!;
print TXT $q->param("name") . "\n" . $q->param("email");
close(TXT);

Should do the trick.

- Mark

chaotic
07-25-2002, 01:48 AM
thanks dude :thumbsup: