can somebody tell me what is up with this please..
[syntax=php]
if($_GET['action']=="changefilter")
{
echo "CHANGING FILTER";
}
else
{
echo "MUSIC";
}
else if($_GET['filter']=="hello")
{
echo "MUSIC FOR USER...";
}
[/syntax]
if i take out the :
[syntax=php] else if($_GET['filter']=="hello")
{
echo "MUSIC FOR USER...";
}[/syntax]
it works but with it.. it doesnt :\..
Php else.
Re: Php else.. [ SOLVED ]
when using if() {} elseif () {} 's you should only have "else" on it's own for if all if() have failed. having a random else, then an elseif will not work.
Re: Php else.. [ SOLVED ]
Dominion wrote:when using if() {} elseif () {} 's you should only have "else" on it's own for if all if() have failed. having a random else, then an elseif will not work.
it works i just had it the wrong way around
I would put a signature.. BUT, i don't have the time.
Re: Php else.. [ SOLVED ]
ashwood wrote:Dominion wrote:when using if() {} elseif () {} 's you should only have "else" on it's own for if all if() have failed. having a random else, then an elseif will not work.
it works i just had it the wrong way around
As i said you can't have a random else in the middle of elseif()'s has to be at the end...
![Laughing :lol:](./images/smilies/icon_lol.gif)