For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > December 2004 > Printing to a Text File With CGI.PM









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Printing to a Text File With CGI.PM
Imogen

2004-12-07, 3:55 am

Hello,

I hope someone will be able to help me resolve this. I have the following
CGI script set up to write a file. The script runs fine (no errors), but is
not writing to the file. I'd appreciate any tips you can offer to help
resolve this.

Thanks, Maureen

#!/usr/local/bin/perl -wT
use CGI ':standard';
my $comments, $FirstName, $LastName, $FullName, $gift, $email, $Address,
$Address2, $City, $State, $zip_code, $phone, $ext, $gift, $type, $num1,
$num2, $num3, $num4, $nameoc, $expires;
$comments = param('comments');
$FirstName = param('FirstName');
$LastName = param('LastName');
$FullName = $FirstName . ' ' . $LastName;
$Address = param('Address');
$Address2 = param('Address2');
$City = param('City');
$State = param('State');
$zip_code = param('zip_code');
$phone = param('phone');
$ext = param('ext');
$email = param('email');
$gift = param('gift');
$type = param('type');
$num1 = param('num1');
$num2 = param('num2');
$num3 = param('num3');
$num4 = param('num4');
$nameoc = param('nameoc');
$expires = param('expires');
open (LOG, ">>sail.txt") || Error('open', 'file');
print LOG "Donor's Name: $FullName\n";
print LOG "Street Address: $Address\n";
print LOG "Secondary Address Information: $Address2\n";
print LOG "City: $City\n";
print LOG "State: $State\n";
print LOG "Zip Code: $zip_code\n";
print LOG "Phone: $phone\n";
print LOG "Extension: $ext\n";
print LOG "Email Address: $email\n";
print LOG "Dollar Amount of Gift: $gift\n";
print LOG "Card Type: $type\n";
print LOG "First Num: $num1\n";
print LOG "Second Num: $num2\n";
print LOG "Third Num: $num3\n";
print LOG "Fourth Num: $num4\n";
print LOG "Card Name: $nameoc\n";
print LOG "Expires: $expires\n";
print LOG "Donor's Comments are: $comments\n\n\n";
close (LOG);



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com