RE: [PHP] [Q] Howto go directly to a URL?

From: Date: Fri, 13 Feb 2004 21:15:22 +0000
Subject: RE: [PHP] [Q] Howto go directly to a URL?
Groups: php.general 
Request: Send a blank email to php-general+get-177648@lists.php.net to get a copy of this message
Alex Hogan <mailto:Alex.Hogan@AlliedElec.com> on Friday, February 13, 2004 1:10 PM said: > if($login == "successful"){ > $url = "yourin.php"; > } > else{ > $url = "tryagain.php": > } > > header("Location: $url"); don't forget the rest of the url and don't forget to exit like matt said... i suggest defining a constant somewhere and including it (a configuarion file perhaps????): define("WEB_ROOT", "http://myhappydomain.com/"); it can then be used like: header("Location: ".WEB_ROOT."$url"); exit; you can even take it one step further and make a function out of it. function redirect($url) { header("Location: ".WEB_ROOT."$url); exit; } use it thusly: redirect($url); hth, chris.

« previous php.general (#177648) next »