Hi All,

I'm trying to pass a variable from a form to a perl script. It produces the error:-

"CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers." when run it (call it from the click of a submit button on an html form) but I don't get it - in my limited experience this is normally a syntax error but I'm blowed if I can see what's wrong here!

#!/usr/bin/perl

use CGI qw(:standard);

my $button_value = param('name');

many thanks in advance
Sarah

CGI scripts must return something to the browser, at minimum that would be an HTTP header. The header must also be printed before anything else gets printed back to the browser.

#!/usr/bin/perl
use CGI qw(:standard);
print header; #<-- prints the http header using the CGI module
my $button_value = param('name');
print $button_value;

See the CGI modules documentation for details.

that's great thank you :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.