So I have this IF statement in my view. it works and all, but wondering if there’s a better way to write this. Having both session calls seem unneccessary…
if($this->session->userdata('campaign_name')){
echo $this->session->userdata('campaign_name');
}
else {
echo 'this';
}
Note this function will be used inline on a text input. So I’m looking for as minimal code as possible.
Note that CI’s Session class’s userdata method will return false if no
campaign_nameexists. So assign a variable to the potentially undefined array key (campaign_name)OR
Controller Method (/application/controllers/test_controller.php)
View (/application/view/test_view.php)