Halide
08-18-2002, 12:32 PM
Since I had some trouble initially, here's a brief overview.
To redirect to another page, you can use the header() call as seen below. However, it must be before any HTML output. You could use output buffering to prevent any mishaps.
header("Location: http://full-url-goes-here/path/file.php?action=stuff");
Then you most likely should put exit(); after this, since anything after this will not be viewed anyway (I think).
For obtaining the URL, you can use the following:
$url = "http://" . $HTTP_HOST . $PHP_SELF;
$url_path = dirname($url);
[UPDATE] Sometimes if setting cookies before this, you will have trouble when clients read the cookie header before/after the Location: part... I'm no expert on it... but I fixed my problem by using a Refresh header instead with a delay...
To redirect to another page, you can use the header() call as seen below. However, it must be before any HTML output. You could use output buffering to prevent any mishaps.
header("Location: http://full-url-goes-here/path/file.php?action=stuff");
Then you most likely should put exit(); after this, since anything after this will not be viewed anyway (I think).
For obtaining the URL, you can use the following:
$url = "http://" . $HTTP_HOST . $PHP_SELF;
$url_path = dirname($url);
[UPDATE] Sometimes if setting cookies before this, you will have trouble when clients read the cookie header before/after the Location: part... I'm no expert on it... but I fixed my problem by using a Refresh header instead with a delay...