Posted by Ron on 10/22/06 16:33
"wouter" <no@spam.nl> wrote in message
news:453b9820$0$9457$ba620dc5@text.nova.planet.nl...
> hey hi.....
>
> I wanna make a switch wich does this:
>
> if pagid is set do A,
> if catid is set do B,
> if projectid is set do C,
> else do D.
>
> So i was thinking something like this:
>
> switch()
> {
> case isset ($_GET['pagid']): {
> echo "pagid= set";
> }
> break;
> case isset ($_GET['catid']):
> {
> echo "catid= set";
> }
> break;
> case isset ($_GET['projectid']):
> {
> echo "projectid= set";
> }
> break;
> default:
> {
> echo "nothing set";
> }
> }
>
>
> wich works great in my mind but not on my server....
>
> Anybody here know how to do this in a way wich does work??
You are mis-using the switch syntax check the manual
Switch only tests for different values in a single variable.
I assume from your text that the states are either mutually exclusive or
that pagid being set has precedence over the other variables
you could simply do this as if / elsif /elsif /else.
Cheers
Ron
Navigation:
[Reply to this message]
|