| Trunikov 2007-01-12, 3:55 am |
|
Peter Church wrote:
[cut]
> I start the program with this
> my $handler = new CGI;
>
> print $handler->header("text/html");
> print $handler->start_html("Configurations");
> print $handler->startform("GET","http://${server_name}${script_name}",
> "text/plain");
>
> and close the script eachtime using
>
> print $handler->endform;
> print $handler->end_html();
> exit(0);
>
> When I call the script the first time all is well however when I hit the
> submit button and the second form loads I get "Content-Type: text/html;
> charset=ISO-8859-1"
> strings :(
>
> What am I missing ?
IMHO following line is wrong:
print $handler->startform("GET","http://${server_name}${script_name}",
"text/plain");
especially third argument - "text/plain". Just write:
print $handler->startform("GET","http://${server_name}${script_name}");
BTW, HTTP method GET is not in a favour. Method POST is preferable.
Therefore last version of line is:
print
$handler->startform("POST","http://${server_name}${script_name}");
Moreover, if a CGI script dispays form and processes it submit is the
same (i.e. have the same URL) then you can omit this URL:
print $handler->startform("POST");
|