Re[2]: [PHP] Re: weird header() (bug may be)
Hello Jason, Thursday, February 12, 2004, 6:38:05 AM, you wrote: It should be this: header(Location: another_page.php); and NOT header(Location:another_page.php); JW Also it should be an absolute URL otherwise it might break on some (standards JW compliant only) browsers: While I totally agree with both these pieces of advice, they're unlikely to be the cause of the problem. YES you should have a space after the Location: part and YES you should have an absolute URL, *but* most modern browsers won't care if you haven't - the following works perfectly on IE6/Opera7/Firefox - no matter how malformed it looks: Header(Location:page2.php); Chris provided the solution to the original problem in his reply, but I just wanted to bring this up. The OP should of course modify his header statements, but its unlikely to resolve his problem on its own. -- Best regards, Richardmailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Re: weird header() (bug may be)
Hello Eric, Thursday, February 12, 2004, 10:57:57 PM, you wrote: EB That's pretty wierd EB Think i'll do some research on headers, need more info anyway ;) EB But did my tip work in your script when you took a space there? EB Just wondering... EB Eric No it still doesnt work ... I have to put die() or exit() after calling the header(); and whether I put space and not using space .. the result still same .. ( I am get used not to use space for almost 1 year .. and suddenly I just know that I should put space :) ) In my logic, after we call header('location: foo.php'); the php processor should terminated and open the page foo.php instead ... cmmiw -- Best regards, adwinwijayamailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[3]: [PHP] Re: weird header() (bug may be)
Hello adwinwijaya, Thursday, February 12, 2004, 12:27:07 PM, you wrote: a In my logic, after we call header('location: foo.php'); the php a processor should terminated and open the page foo.php instead ... Except that doesn't happen. See my other reply on this subject. -- Best regards, Richardmailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: weird header() (bug may be)
On 12 Feb 2004 at 17:20, adwinwijaya wrote: Hello php-generaler's , I have a script like this : if($foo == 'something'){ header('Location:to_another_page.php') ; }else { do another thing in here } header('Location:to_previous_page.php'); I got a problem ... when $foo == 'something' .. it wont redirect me to to_another_page.php but if I put die(); after calling header(); .. it will work ... is this the bug ? You're joking, right? Your second header statement is outside the if/else loop, so it's executed every time, obviously. This in turn means that your script will always redirect to previous_page.php, unless, of course, you kill it before it gets to the second header statement. Suggestion: read up on control structures (chapter 11 in the PHP manual). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: weird header() (bug may be)
This is not a bug. Here you expect that the script should end executing after the statement:header('Location:to_another_page.php') if the if statement is true. But it won't and it proceeds to the next statement; the next header statement:header('Location:to_previous_page.php'); An exit statement after the first header will solve the problem. With most browsers, if multiple redirect headers are received, the last instruction is followed. I'm not sure what the RFC says about this. Anil On Thu, 12 Feb 2004, adwinwijaya wrote: Hello php-generaler's , I have a script like this : if($foo == 'something'){ header('Location:to_another_page.php') ; }else { do another thing in here } header('Location:to_previous_page.php'); I got a problem ... when $foo == 'something' .. it wont redirect me to to_another_page.php but if I put die(); after calling header(); .. it will work ... is this the bug ? I use php 4.3.4 ... and Apache 2.x thanks -- Linuxense Information Systems Pvt. Ltd., Trivandrum, India http://www.linuxense.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: weird header() (bug may be)
Headers have to be pretty accurate, or it will cause trouble. And your redirect header is not quite correct. It should be this: header(Location: another_page.php); and NOT header(Location:another_page.php); What you need here is a space between Location: and the URL. Adwinwijaya [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello php-generaler's , I have a script like this : if($foo == 'something'){ header('Location:to_another_page.php') ; }else { do another thing in here } header('Location:to_previous_page.php'); I got a problem ... when $foo == 'something' .. it wont redirect me to to_another_page.php but if I put die(); after calling header(); .. it will work ... is this the bug ? I use php 4.3.4 ... and Apache 2.x thanks -- Best regards, adwinwijaya mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: weird header() (bug may be)
On Thursday 12 February 2004 14:40, Eric Bolikowski wrote: Headers have to be pretty accurate, or it will cause trouble. And your redirect header is not quite correct. It should be this: header(Location: another_page.php); and NOT header(Location:another_page.php); What you need here is a space between Location: and the URL. Also it should be an absolute URL otherwise it might break on some (standards compliant only) browsers: header(Location: http://www.example.tld/another_page.php;); -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Honesty is the best policy, but insanity is a better defense. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php