Praveena Vittal wrote:
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 ...

But then there aren't any POSTed parameters to be passed along with the redirect, are there?

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

Then you printed two consecutive line breaks in some other way... If you want us to help you debug your code, you need to post a short but _complete_ program that exhibits the problem you are having.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

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


Reply via email to