PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
php manual wrote:'HTTP_REFERER'
The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.
ok, well i did some error checking and printed $_SERVER['HTTP_REFERER'] and in the current situation i am redirecting to http://localhost/ and my header argument is Location: http://localhost/
I've seen a similar problem on IIS which relates to a bug in IIS that won't let you set a cookie and then do a redirect. I don't think that this affects Apache but you may want to try removing the setcookie stuff (maybe save the info to a session) just to test.
The point about HTTP_REFERER that was made by the quote from the manual still stands though - because you can't rely on it to exist or to be correct, you should consider finding a different way of determining where in your site the user has come from.
One more thing, have you tried hardcoding a URL into the header() function to see if that works?
yep, tried a hardcoded URL but still no redirection. tried commenting out the setcookie lines and no affect. about the HTTP_REFERER point, thats a good thing to know but right now i want to make this thing work.
Have you tried putting a header() function call into a PHP file which doesn't have anything else in it? If that doesn't work then it may be that somethings not quite right with your Apache setup.
i didn't change the format the "-" is where the HTTP response number goes in most cases. there are a few times when Apache does not send an HTTP reponse code. not sure of the details but the point is that Apache is not sending the HTTP/1.1 302 at all and this worries me.