FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Header and if statement
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Header and if statement [message #180019 is a reply to message #180017] Wed, 26 December 2012 18:44 Go to previous messageGo to previous message
Peter H. Coffin is currently offline  Peter H. Coffin
Messages: 245
Registered: September 2010
Karma:
Senior Member
On Wed, 26 Dec 2012 09:29:34 -0800, Richard Yates wrote:
> On Mon, 29 Oct 2012 09:36:53 +0100, Bo Wis?n <bowisen(at)telia(dot)com>
> wrote:
>
>> Hi,
>>
>> I want to redirect to one page if $typ=0 and another page if $typ=1. I'm
>> trying this code:
>>
>> if ($typ == 0) {
>> header ("Location:page1.php");
>> } else {
>> header ("Location:page2.php");
>> }
>>
>> But undepending on the value of $typ it redirects to page1.php. Why?
>>
>> / Bo
>
> Try adding exit; after each header statement and before the closing
> curly brace.

Also make sure that $typ contains what you think it does, and make sure
that you're reporting errors. For example, unset and variables
holding false results evaluate == 0 (but do not === 0).

--
Every normal man must be tempted at times to spit upon his hands, hoist
the black flag, and begin slitting throats.
-- HL Mencken
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Happy New Year
Next Topic: does the php is not popular?i am a phper?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 18:00:46 GMT 2024

Total time taken to generate the page: 0.03836 seconds