At the end of a case declaration in PHP the colon (:) is required... the
structure should look like this:

Switch ($myVar)
{
        case '1':
                [...];
                break;
        case '2':
                [...] // if a break; isn't inserted the code in the next
branch will be executed also
        Case '3':
                [...];
                break;
        default:
                [...]; // when no case is matched default is called
} // end switch

Hope this helps

Dan
--

-----Original Message-----
From: Portman [mailto:[EMAIL PROTECTED] 
Sent: 09 January 2006 16:52
To: [email protected]
Subject: Re: [wdvltalk] location: wits end

I don't know php but this is my stab in the dark: you have a colon at 
the end of case "1", not a semicolon. In Perl you need semicolons at the 
end of each line. Not sure if it is the same in php.

Riva

steve miller wrote:

> 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.
>

____ . 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.

__________ NOD32 1.1356 (20060108) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com



____ • 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