+1  A: 

Use the in_array() function to write you condition:

<?php if (in_array($mycat, array("animation", "direction", "grading")))
greg0ire
+1  A: 

Path 1:

<?php if ($mycat == "animation" || $mycat == "direction" || $mycat == "grading"){ 

Path 2:

<?php if (in_array($mycat,array("animation","direction","grading"))) {
Fosco
+7  A: 

Create an array holding the values, then test if the value of $mycat exists in the array. Also, you're echoing the link whatever $mycat is, so the else statement can be completely dropped and the if structure further simplified to just the following:

$categories = array(
    'animation', 
    'direction', 
    'grading', 
    'online', 
    'showcase', 
    'showreel', 
    'vfx'
);

if (in_array($mycat, $categories)) {
    $_SESSION["theCategory"] = $mycat;
}

?>
<a href="<?php bloginfo('home')?>/category/<?php echo $_SESSION["theCategory"];?>"><?php echo $_SESSION["theCategory"];?></a>

And like others have said, remember to escape your output.

BoltClock
Hah 1 min late, almost exact same code.. +1 :)
kemp
@kemp: +1 back to you anyway ;)
BoltClock
Actually, if you look at his final else statement, you can see that it captures *everything* regardless of if it's in the array or not. So as insecure as this is - escaping anyone? - you can simplify it to this:<a href="<?php bloginfo('home')?>/category/<?php echo $_SESSION["theCategory"];?>"><?php echo $_SESSION["theCategory"];?></a>
CaseySoftware
@CaseySoftware: thanks, I knew there was something I missed. I edited my answer.
BoltClock
+5  A: 

Something like this?

<?php
$cats = array(
    'animation',
    'direction',
    'grading',
    'online',
    'showcase',
    'showreel'
    'vfx',
);
if ( in_array($mycat, $cats) ) :
    $_SESSION['theCategory'] = $mycat; ?>
    <a href="<?php bloginfo('home')?>/category/<?php echo $mycat;?>"><?php echo $mycat;?></a>
<?php else: ?>
    <a href="<?php bloginfo('home')?>/category/<?php echo $_SESSION["theCategory"];?>"><?php echo $_SESSION["theCategory"];?></a>
<?php endif; ?>
kemp
I love how we're both getting the same number of upvotes and how they're coming in simultaneously.
BoltClock
Why the downvote?
kemp
I didn't down-vote, but perhaps for the duplicated code (both A elements are identical)... Not a big deal (especially since you avoid the additional array lookup), but I could understand why someone MIGHT consider that "not great"...
ircmaxell
Ah, yes that's a good point
kemp
+2  A: 

I don't understand why you even need a conditional here. You're not changing anything inside each conditional possibility.

$_SESSION["theCategory"] = $mycat;
<a href="<?php bloginfo('home')?>/category/<?php echo $_SESSION["theCategory"];?>"><?php echo $_SESSION["theCategory"];?></a>
David O.
+1 Nice catch David
Fosco
I guess the conditional is there as a white list
kemp
Thanks @Fosco. I had that thought too @kemp, but the 'else' statement at the end which basically prints the same href regardless of a match or not led me to a state of relative confusion :) A whitelist using in_array() is definitely appropriate here, but the bigger question is what does he want to do when no match is found?
David O.
+5  A: 

And using the switch statement:

switch($mycat) {
    case 'animation':
    case 'direction':
    case 'grading':
    case 'online':
    case 'showcase':
    case 'showreel':
    case 'vfx':
        $_SESSION["theCategory"] = $mycat; 
    default:
        ?>
        <a href="<?php bloginfo('home')?>/category/<?php echo $_SESSION["theCategory"];?>"><?php echo $_SESSION["theCategory"];?></a>
        <?php
}

Note the fall-through after the case statements. You could either do that, or:

switch($mycat) {
    case 'animation':
    case 'direction':
    case 'grading':
    case 'online':
    case 'showcase':
    case 'showreel':
    case 'vfx':
        $_SESSION["theCategory"] = $mycat; 
}
?>
<a href="<?php bloginfo('home')?>/category/<?php echo $_SESSION["theCategory"];?>"><?php echo $_SESSION["theCategory"];?></a>
<?php
ircmaxell