[ back to toc ]

CGI Output

Date: 2002/05/23 11:22

I work for the library and need some help on a form that will survey our
users on our site about their zip codes. The problem I am having is the
output of the form. I would like the data to be sent to a text file on
submission and each submission will populate the text file. The form
submits fine (without errors), but the text file generated is blank.

This is the code I am using to call the file:
# this is where the info will be written to - you need to specify a real
$file ="$ENV{DOCUMENT_ROOT}/files/zip_results.txt"; #must be read/writable

This is the code where the output format is defined:
#print "Content-type: text/plain\n\n ";
open(OUTPUT, ">>$file");
print OUTPUT "$contents{'zip'}\n";

close (OUTPUT);

Any ideas why the text file isn't populating?
Not really. At least nothing that is an apparent error. Be aware that the
CGI script is ran by a user, which is usually called www-data or nobody or
similar. This is the user, who has to have the right to write the file

Also the directory containing the file should have the appropriate


[ back to toc ]