On Wed, 26 Sep 2001, Wagner wrote:

> I want to do a redirection based on a variable....
>
> for example:
>
> if ($name eq 'invader') {
>
> redirection to some URL ;
>
> }
>
> What do i have to put in the middle line to do the redirection...

If you are using CGI.pm, there is a method called redirect:

my $cgi = new CGI;

$cgi->redirect($new_url);

BTW, this has to be done before any headers are sent from the web server,
or it won't work correctly.  In fact, the redirection method sends its own
header, so you shouldn't send any header after you use this method, since
nothing will be displayed from the CGI script once the redirection is
done.

See http://stein.cshl.org/WWW/software/CGI/cgi_docs.html#header for more
details.

-- Brett

------------------------------------------------------------------------
I've read SEVEN MILLION books!!


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to