<on 21.05.01, Timothy Kimball wrote>
> 
> Gary Madden wrote:
> : In response to a user filling out and submitting a form, I want to send
> : the user an HTML page whose URL I've stored as a hidden value on the
> : forms page instead of creating the page within the cgi script. (The
> : other functions of my script work properly.) This way the page name and
> : the page content can be dynamic while the script remains static.
> 
> CGI.pm has a redirect method:
> 
> use CGI qw( :cgi );
> 
> ...
> 
> print STDOUT redirect( $url );
> 
> Or you can do it yourself by sending the proper HTTP response header:
> 
> print STDOUT "Status: 302 Moved\n";
> print STDOUT "Location: $url\n"
> print STDOUT "\n";
> 
> -- tdk
</>

Or using the object-oriented CGI.pm style.. 
If the form has a field like 
<input type="hidden" name="url_from_form" value="http://some.place.somewhere/foo.html";>

The code could be:-

use CGI;
my $q = new CGI;

# form processing here

my $url = $q->param('url_from_form');
print $q->redirect($url);

CGI.pm's redirect can not guarantee to successfully redirect to relative locations,
so a fully qualified URL is preferable.

:)
have fun!
--lucy


-- 
Lucy Newman [EMAIL PROTECTED]

 

Reply via email to