Problems with header("Location: ")
| From: | turnbull@silkspin.net | Date: | Thu, 27 Jul 2000 20:28:26 +0000 |
| Subject: | Problems with header("Location: ") | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-8654@lists.php.net to get a copy of this message | ||
I'm trying to redirect a user after filling out a form the process SHOULD
work like this:
User opens page which checks for cookie "usertype" or "usertypesaved" if the
cookies are not found, user is redirected to a form to fill out what kind of
user he/she is. HTTP_REFERER is added as the value of a hidden form field,
so that I can return the user to their original location with usertype set.
On submit, the script calls setusertype.php (the code below)
---SNIP----
<?php
setcookie("usertype", $userType, 0, "/", ".myserver.com", 0);
if ($save=="on" || $save=="On") {
$expire = time() + 63072000;
setcookie("usertypesaved", $userType, $expire, "/",
".myserver.com", 0);
}
header("Location: $referer");
?>
--SNIP----
Problem: This works just as it should on mac/IE 5, but not Netscape on mac
or any browser on windows. On those browsers, it returns the user to the
directory that the php script is in. I have the header("Location: ")
function working properly elsewhere, so I'm guessing there's an error in
this code (possibly an obvious error I've missed).
Any ideas?
P.S. I cannot use session variables for this process (at least, not very
easily), because usertype must be available to seperate web server, not
running php/apache.
Dave