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

Print to text file

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Please advise why this wont print the variable $webpage1 with the value of "first"??
It doesnt print the value on my page or in the text file.
The text file doesnt have any data in it. why doesnt this work??
[tt]

use CGI qw:)all);
print header;

$webpage1 = param("first");



print "
<html>
<head>
<title>Web Pages for local data.</title>
</head>
<body>
&quot;;

$filepath = &quot;C:/inetpub/
$newtext = &quot;$webpage1\n&quot;;

open (FILE, &quot;>>$filepath&quot;) || &quot;Did not write:$!\n&quot;;
print FILE $newtext;
close (FILE);

print &quot;<p>Data submitted.<br>
<b>$newtext</b></p>&quot;;
print &quot;</body></html>&quot;;
[/tt]
 

You dont need the param function. Try this:
[tt]
$webpage1 = &quot;first&quot;;[/tt] =================
Bad Company Music
=================
 
You do need the param function if you want to access data that was sent to the script.
How are you invoking the script? Maybe there isn't a first parameter at all. Try invoking it like this:
scriptname?first=test
and see if that prints &quot;test\n&quot; to your text file. //Daniel
 
Thanks it now works. It didnt need the param part as badco said.

 
Of course it works, but it will always print &quot;first\n&quot; to the file. Is this really what you wanted? //Daniel
 
Yes it does exactly what i needed, thanks for your all your replies.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top