RE: Problems getting a simple form to work.
Hi Li, Rob and Mark. Thanks for your help. My site is being hosted by Hypermart, so I don't have access to /var/log/httpd. My new simpleform.cgi now looks like this: #!/usr/local/bin/perl -wT use CGI; use strict; $username = param('username'); print Content-type: text/plain\n\n; print You entered: $username\n; The permissions look like this: Permissions for cgi-bin: rwxr-xr-x Permissions for simpleform.cgi rwxr-xr-x Permissions for simpleform.htm: rwxr-xr-x I have changed form method=post action=../cgi-bin/simpleform.pl to form method=post action=http://www.mikyo.com/cgi-bin/simpleform.cgi;. I am still getting the 500 error. Thanks, - Mike -Original Message- From: Li Ngok Lam [mailto:[EMAIL PROTECTED] Sent: Friday, April 04, 2003 1:16 PM To: Mike Butler; [EMAIL PROTECTED] Subject: Re: Problems getting a simple form to work. [..] Can anyone tell me what I'm doing wrong? Also, is there a way to turn on error.log? Actually, error.log is always turned on... If you are not running the server on yours own, ask the server admin where is the error.log located. [..] Permissions for cgi-bin: rwxr-xr-x Permissions for simpleform.htm: rwxr-xr-x What about your script ? simpleform.pl [..] #!/usr/local/bin/perl use CGI; # You missed this $username = param('username'); You can't ask a value from param without use CGI in this case. print Content-type: text/plain\n\n; print You entered: $username\n; One more point, when you are going to write a script for real running, always use strict You will know how pain it is to remember all the var names that you've declared along the whole script. And most likely have to rewrite the whole thing again when touching to maintenence or debugging... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problems getting a simple form to work.
Thanks, Andrew. I added CGI::Carp qw(fatalsToBrowser); to the script. That's a big help. The error message that I get now is: Software error: Undefined subroutine main::param called at simpleform.cgi line 6. Line 6 is my $username = param('username'); Any idea why param is undefined? Thanks, - Mike -Original Message- From: Hughes, Andrew [mailto:[EMAIL PROTECTED] Sent: Friday, April 04, 2003 3:09 PM To: [EMAIL PROTECTED] Subject: RE: Problems getting a simple form to work. I would also add use CGI::Carp qw(fatalsToBrowser); along with use CGI; use strict; This way your errors will get displayed in your browser. Also, check with your hosting company to make sure that your path to perl is correct (ex. is it #!/usr/local/bin/perl -wT vs. #!/usr/bin/perl -wT) Andrew -Original Message- From: Li Ngok Lam [mailto:[EMAIL PROTECTED] Sent: Friday, April 04, 2003 2:37 PM To: Mike Butler; [EMAIL PROTECTED] Subject: Re: Problems getting a simple form to work. [..] #!/usr/local/bin/perl -wT use CGI; use strict; $username = param('username'); should be : my $username = param('username'); because you've using strict; print Content-type: text/plain\n\n; For what I know, I would write as Content-type: text/html\n\n; print You entered: $username\n; The permissions look like this: Permissions for cgi-bin: rwxr-xr-x Permissions for simpleform.cgi rwxr-xr-x Permissions for simpleform.htm: rwxr-xr-x I have changed form method=post action=../cgi-bin/simpleform.pl to form method=post action=http://www.mikyo.com/cgi-bin/simpleform.cgi;. 2 suggestion here : 1. use CGI::Carp 'fatalsToBrowser'; # the die message will goto your browser. 2. Try simpler script, so you will know if your form is going to a right place : #!/usr/bin/perl print Content-type: text/html\n\n; print Hello world; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problems getting a simple form to work.
Thanks, Andrew. That did it. It's working now. :) :) :) Thanks everyone for all your help. - Mike -Original Message- From: Rob Benton [mailto:[EMAIL PROTECTED] Sent: Friday, April 04, 2003 4:38 PM To: Mike Butler Cc: Hughes, Andrew; [EMAIL PROTECTED] Subject: RE: Problems getting a simple form to work. Give this a shot and see if it errors: use CGI; my $query = new CGI; my %params = $query-Vars; my $username = $params{'username'}; On Fri, 2003-04-04 at 15:29, Mike Butler wrote: Thanks, Andrew. I added CGI::Carp qw(fatalsToBrowser); to the script. That's a big help. The error message that I get now is: Software error: Undefined subroutine main::param called at simpleform.cgi line 6. Line 6 is my $username = param('username'); Any idea why param is undefined? Thanks, - Mike -Original Message- From: Hughes, Andrew [mailto:[EMAIL PROTECTED] Sent: Friday, April 04, 2003 3:09 PM To: [EMAIL PROTECTED] Subject: RE: Problems getting a simple form to work. I would also add use CGI::Carp qw(fatalsToBrowser); along with use CGI; use strict; This way your errors will get displayed in your browser. Also, check with your hosting company to make sure that your path to perl is correct (ex. is it #!/usr/local/bin/perl -wT vs. #!/usr/bin/perl -wT) Andrew -Original Message- From: Li Ngok Lam [mailto:[EMAIL PROTECTED] Sent: Friday, April 04, 2003 2:37 PM To: Mike Butler; [EMAIL PROTECTED] Subject: Re: Problems getting a simple form to work. [..] #!/usr/local/bin/perl -wT use CGI; use strict; $username = param('username'); should be : my $username = param('username'); because you've using strict; print Content-type: text/plain\n\n; For what I know, I would write as Content-type: text/html\n\n; print You entered: $username\n; The permissions look like this: Permissions for cgi-bin: rwxr-xr-x Permissions for simpleform.cgi rwxr-xr-x Permissions for simpleform.htm: rwxr-xr-x I have changed form method=post action=../cgi-bin/simpleform.pl to form method=post action=http://www.mikyo.com/cgi-bin/simpleform.cgi;. 2 suggestion here : 1. use CGI::Carp 'fatalsToBrowser'; # the die message will goto your browser. 2. Try simpler script, so you will know if your form is going to a right place : #!/usr/bin/perl print Content-type: text/html\n\n; print Hello world; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]