Hi Dan.

die() and exit() stop the script, but I am getting no re-direct to index.html. If I echo out some placeholders, I find that the script jumps over the header statement and then stops.

For example:

if($no==1)
{
echo "2";
header ("Location: index.html");
echo "3";
exit();
}


prints out 2 and 3, then quits with no re-direct. The thing that puzzles me is that this same exact code works in some pages in the same directory on the site, but not in others. What could cause that?

steve



On Jan 9, 2006, at 11:08 AM, Dan Parry wrote:

Try using the break inside switch cases but not in an if loop

Also try using die(); (or exit()) directly after the header() as this
prevents further script execution[1]

Dan
--

[1] Source: http://uk2.php.net/manual/en/function.header.php

-----Original Message-----
From: steve miller [mailto:[EMAIL PROTECTED]
Sent: 09 January 2006 15:56
To: [email protected]
Subject: [wdvltalk] location: wits end

Hi all.

I am at my wits end trying to figure out why the following php does not
work:

switch ($no)
{
case "1":
echo "1";
header ("Location: index.html?xx=2");
echo "2";
break;
}

I set $no to equal 1, and the page will not re-direct to index.html. I
also tried:

if($no==1)
{
header ("Location: index.html?xx=2");
}

and it will not re-direct either. If I try:

if($no==1)
{
header ("Location: index.html?xx=2");
break;
}

I get a fatal error about level 1 break/continue. The weird thing is
that I am using this exact same stuff on other pages in this site and
they work fine!

Any ideas on what to look for?

steve



____ • The WDVL Discussion List from WDVL.COM • ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
      Send Your Posts To: [email protected]
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.

Reply via email to