Hi All,

see my comments inline

Gunnar Hjalmarsson wrote, On 08/27/2007 07:36 PM:

Praveena Vittal wrote:


#!/usr/bin/perl
use CGI;
my $query =new CGI;

<----some other stuffs will be here-->
print $query->redirect('http://google.com');


When i run this code


How do you run it? Is the script URL in the action attribute when POSTing an HTML form? In that case, and if you want the request to be redirected, the _only_ code you need is:

    #!/usr/bin/perl
    print "Status: 307\nLocation: $location\n\n";


Run this code means,refreshing the url to see the changes ...

i am getting a blank page with the following printed in the screen...

Status: 302 Moved Location: http://google.com

and not redirecting to the url given...


That's because your "other stuffs" includes printing of two consecutive line breaks. Maybe you had

    print $query->header;

there, which you shouldn't have in the case of a redirect.

I did not included the above mentioned line

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


Reply via email to