I'm trying to create a little form usign CGI.pm but I get this error from
apache:
 malformed header from script. Bad header=<form method="post" action="/c:
/usr/lib/cgi-bin/make_graph_CPU_form.pl.cgi

this is my perl code:

#!/usr/bin/perl
use CGI qw/:standard/;

sub print_form {
        print start_form,
        "Metriche:",
         checkbox(-name=>'usr',-checked=>1),
         checkbox(-name=>'sys',-checked=>0),
         checkbox(-name=>'wio',-checked=>0),
         checkbox(-name=>'idle',-checked=>0),
         reset(-name=>'Reset'),
         submit(-name=>'Go!'),
         end_form;
};

print header,
        start_html('RRDTool CPU Usage Monitor'),
        h1('RRDTool CPU Usage Monitor'),
        print_form(),
        "Nothing to it!\n",
        end_html;

I don't understand why apache tells:"action="/c:
/usr/lib/cgi-bin/make_graph_CPU_form.pl.cgi" when the form prints out "<form
method="post" action="/./make_graph_CPU_form.pl.cgi"
enctype="application/x-www-form-urlencoded">"
Could you help me?

Please replace :
<snip> 
sub print_form {
        print start_form,
</snip>

with 

<snip>

sub print_form {
        return start_form,
</snip>

...

You can also always see what you are generating by running the cgi script
from the commamd prompt... 

DEV,SUN2>./foo.cgi
(offline mode: enter name=value pairs on standard input)
{reply ctrl+d}
Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML><HEAD><TITLE>RRDTool CPU Usage Monitor</TITLE>
</HEAD><BODY><H1>RRDTool CPU Usage Monitor</H1><FORM METHOD="POST"
ENCTYPE="application/x-www-form-urlencoded">
Metriche:<INPUT TYPE="checkbox" NAME="usr" VALUE="on" CHECKED>usr
<INPUT TYPE="checkbox" NAME="sys" VALUE="on">sys
<INPUT TYPE="checkbox" NAME="wio" VALUE="on">wio
<INPUT TYPE="checkbox" NAME="idle" VALUE="on">idle
<INPUT TYPE="reset" VALUE="Reset"><INPUT TYPE="submit" NAME="Go!"
VALUE="Go!"><INPUT TYPE="hidden" NAME=".cgifields" VALUE="usr"><INPUT
TYPE="hidden" NAME=".cgifields" VALUE="idle"><INPUT TYPE="hidden"
NAME=".cgifields" VALUE="wio"><INPUT TYPE="hidden" NAME=".cgifields"
VALUE="sys"></FORM>Nothing to it!
</BODY></HTML>DEV,SUN2>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to