How to make Panel section dynamically active in php

# Make TAb panel Active dynamically

//active tab option

$profile_active     = "active"; 

$profile_paneActive = "active";  

$addresses_active = ""; $addresses_paneActive = "";

$orders_active    = ""; $orders_paneActive    = "";

if($active_tab = $this->input->get('tab')){

    $profile_active = ""; $profile_paneActive = ""; 


 switch($active_tab){
   case 'orders':
     $orders_active="active";               $orders_paneActive = "active"; 
  break;

 case 'addresses':
               $addresses_active     = "active"; 
              $addresses_paneActive = "active"; 

 break;

 case 'profile':
               $profile_active     = "active"; 
              $profile_paneActive = "active"; 

 break;
default:
              $profile_active     = "active"; 
             $profile_paneActive = "active";

    break;
    }
}
//active tab option : Ends