Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #7951
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | "Peter H. Coffin" <hellsop@ninehells.com> |
| Newsgroups | comp.lang.php |
| Subject | Re: Header and if statement |
| Date | Wed, 26 Dec 2012 12:44:23 -0600 |
| Organization | A noiseless patient Spider |
| Lines | 30 |
| Message-ID | <slrnkdmhc7.4ja.hellsop@nibelheim.ninehells.com> (permalink) |
| References | <508e4026$1@news.synserver.de> <7tcmd8hq7misu0lucvehtpfkh8d0f5upco@4ax.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| Injection-Info | mx04.eternal-september.org; posting-host="95eff61b8f8136989e561408eae2762f"; logging-data="31575"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+LULL6CJxFAf/F6XgBmRIz" |
| User-Agent | slrn/0.9.9p1 (OpenBSD) |
| Cancel-Lock | sha1:oQY/1vHMTEGWkwMaCaKBaWP60M8= |
| Xref | csiph.com comp.lang.php:7951 |
Show key headers only | View raw
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@telia.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
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Header and if statement Bo Wisén <bowisen@telia.com> - 2012-10-29 09:36 +0100
Re: Header and if statement Denis McMahon <denismfmcmahon@gmail.com> - 2012-10-29 08:47 +0000
Re: Header and if statement Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-10-29 14:54 +0100
Re: Header and if statement Richard Yates <richard@yatesguitar.com> - 2012-12-26 09:29 -0800
Re: Header and if statement "Peter H. Coffin" <hellsop@ninehells.com> - 2012-12-26 12:44 -0600
Re: Header and if statement Simon <bad@example.com> - 2013-01-02 09:26 +0200
csiph-web