For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > January 2007 > Re: Getting "Content-Type: text/html; charset=ISO-8859-1" strings in my pag









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Getting "Content-Type: text/html; charset=ISO-8859-1" strings in my pag
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");

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com