CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
How to redirect to another page

 



terrykhatri531
User

Jul 18, 2014, 2:25 PM

Post #1 of 4 (717 views)
How to redirect to another page Can't Post

Hi guys,

I am trying to redirect to another page after execution of some routine as show below in red and its not working for me :




Code
 
if ( ($action eq "Confirm Delete") && ($prodid =~ /\d+/) && ($orderid =~ /\d+/)) {
my $sql = qq! DELETE FROM "Order_Details"
WHERE "ProductID" = ? AND "OrderID" = ? !;

my $count = $dbh->do( $sql,undef,$prodid,$orderid );
$msg = "$count Record deleted - $sql, $prodid,$orderid";

my $url="http://192.168.56.105/perlproj/cgi-bin/vieworddetails.pl?go=Details&orderid=$orderid";
my $t=1; # time until redirect activates
print "<META HTTP-EQUIV=refresh CONTENT=\"$t;URL=$url\">\n";


} else {




Your help will be much appreciated !

Many thanks.

Terry


terrykhatri531
User

Jul 18, 2014, 2:56 PM

Post #2 of 4 (714 views)
Re: [terrykhatri531] How to redirect to another page [In reply to] Can't Post

Hi,

I found the solution which is :



print "Location: http://192.168.56.105/perlproj/cgi-bin/vieworddetails.pl?go=Details&orderid=$orderid\n\n";



Please consider this as resolved.

Rgds

Terry


Zhris
Enthusiast

Jul 18, 2014, 5:04 PM

Post #3 of 4 (709 views)
Re: [terrykhatri531] How to redirect to another page [In reply to] Can't Post

Or even better! Since you probably have a CGI object at hand, use its redirection header method: http://perldoc.perl.org/CGI.html#GENERATING-A-REDIRECTION-HEADER.

Regards,

Chris


terrykhatri531
User

Jul 18, 2014, 6:44 PM

Post #4 of 4 (705 views)
Re: [Zhris] How to redirect to another page [In reply to] Can't Post

Great, thanks Chris.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives