Uutiset:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu
Advertisement:

custom 'action' with switch case?

Aloittaja Rayne, maaliskuu 08, 2006, 12:17:34 IP

« edellinen - seuraava »

Rayne

(sorry if im posting this in the wrong section) ok i know how to do the custom actions, but what i am wonding is if there is a way to use switch case in side of it i have tired i have tired the following codes to test but only the else{} is working..

if statement style

<?php
if ($var == 1) {
    
printf('one');
} elseif (
$var == 2) {
    
printf('two');;
}
else
{
printf('nothing');
}
?>




<?php
if (isset($HTTP_GET_VARS['action'])) { 
               
$action $HTTP_GET_VARS['action']; 
               switch(
$action) { 
                    case 
"1"
                         
printf('one'); 
                         break;
case "2"
                         
printf('two'); 
                         break;
}
 
}
else
{
printf('nothing');
}
 
?>



any ideas on this?


Advertisement: