Please find the part of the code i used  for  redirection

The function below is called when a button is pressed in a cgi page

sub do_reactivation() {
return if validate_check("Re-Activation",$query->param);
my $url = 'https://sustain-54.central/cgi-bin/sams3_portal/activation.cgi';
print $query->redirect($url);
exit;
}
sub validate_check() {
 my $check_count=0;
 my ($text,@parameter)[EMAIL PROTECTED];
foreach my $select (@parameter) {
 if($select=~/^check/){
      $check_count=$check_count+1;

     }
 }
    if($check_count < 1){
print "<table><tr><td bgcolor='#FF5555'>Please select a record for $text</td></tr></table>";
        return 1;
        }
     if ($text eq 'Re-Activation' && $check_count > 1) {
print"<table><tr><td bgcolor='#FF5555'>Multiple units are not allowed for $text.</td></tr></table>";
        return 1;
       }
   return 0;
}

Regards,
Praveena
Gunnar Hjalmarsson wrote, On 08/28/2007 12:44 PM:

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.



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


Reply via email to