|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Hey, I'm using CGI.pm and I would like to know how to make the browser redirect once a function is complete (changing of a password).
the print "Location: $URL\n\n"; method (when the variable URL is declared, of course) doesn't work. I know there is a way to use print header() to do it but I don't know how. Can anyone give me a hand? |
|
#2
|
|||
|
|||
|
Try something like:
Code:
use CGI qw(:standard);
$query = new CGI;
$agree = "Something";
if ($agree eq 'no') {
print $query->redirect('http://www.oro.net/');
exit 0;
}
|
|
#3
|
|||
|
|||
|
Thank you very much. =)
|
|
#4
|
|||
|
|||
|
Or the old fashion way:
Code:
print "Location: http://www.yoursite.com\n\n"; |
|
#5
|
|||
|
|||
|
I tried to do it the old fashioned way, unfortunately.. that actually printed "Location: URL onto the screen.
|
|
#6
|
|||
|
|||
|
Well that's because you had already printed the content-type header. The Location: setting is a 'header', which means that it must be sent before the end of the headers (end of headers = 2 \n's)
Code:
#!/usr/bin/perl # No headers printed yet print "Location: asdf.html\n\n" # <- note the \n\n at the end |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > Browser Redirects |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|