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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CGI and File

Status
Not open for further replies.

samesale

Programmer
Sep 15, 2003
133
US
Is it possible to create a variable in the program and store it in the file such as ($amount):

open(OUTF,">>card1.out") or dienice("Couldn't open car.out for writing: $!");

$amount = "$16";
print OUTF "$FORM{'amount'}\n";
close(OUTF);
 
Shouldn't be a problem, but if you're looking to save state information have a look at CGI::Session on search.cpan.org

--Paul
 
The code is not writing the correct value:

open(OUTF,">>card1.out") or dienice("Couldn't open car.out for writing: $!");

$amount = "$16"; ## has the value
print OUTF "$FORM{'amount'}\n"; ## has no value
close(OUTF);

should be:


$amount = "$16";
print OUTF "$amount\n";
close(OUTF);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top