Dear Sirs,
As instructed, I put quotations on the attributes of my html file
as follows:
1: <!test.html>
2: <HTML>
3: <HEAD><TITLE>Test: Write to a file</TITLE></HEAD>
4: <BODY BASEFONT="5">
5: <FORM ACTION="http://192.168.1.1/cgi-bin/chap05/test.cgi" METHOD="POST">
6: Name:<INPUT TYPE="text" NAME="Test"><BR><BR>
7: <INPUT TYPE="submit" VALUE="Submit Name">
8: </FORM>
9: </BODY>
10: </HTML>
As you noticed I put the number lines on the scripts here on this email for your
convinience :)
Here's the revised perl script as per your instructions:
1: #!/usr/bin/perl
2: use warnings;
3: use CGI::Carp 'fatalsToBrowser';
4: print "Content-type: text/html\n\n";
5: use CGI qw(:all -debug);
6: use strict;
7:
8: #Declaration of variable
9: my($test);
10:
11: #Assignment to variable
12: $test = param('Test');
13:
14: #save form data to a file
15: open(OUTFILE, ">>/home/markus/cgi-bin/chap05/test.txt") || die "Error: $!";
16: print OUTFILE "$test\n";
17: close(OUTFILE);
18:
19: print "<HTML><HEAD><TITLE>Test: Write to a file</TITLE></HEAD>\n";
20: print "<BODY><H1>Thank you $test...</H1></BODY></HTML>";
Upon running it on my browser, here's the message i got from the
browser:
Content-type: text/html
Software error:
Error: Permission denied at /home/markus/cgi-bin/chap05/test.cgi line 15.
For help, please send mail to the webmaster ([EMAIL PROTECTED]), giving this
error message and the time and date
of the error.
What I did was I changed the permission of my text file, test.txt from 744 to 777.
After the changes, I can now write to my text file. No errors were reported on the
html output.
Thanks a lot for showing me the way to debug. Now, I can move on to the next
lesson with confidence... Any books u may recommend? or articles or tutorials?
Thanks,
Mark Anthony C. Sioting
--
______________________________________________
http://www.linuxmail.org/
Now with e-mail forwarding for only US$5.95/yr
Powered by Outblaze
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]