[eluser]Dandy_andy[/eluser]
I'm fairly new to PHP and have a question on passing an array. In a library class, I have a function under which there is an array of options. I am doing things this way for a few reasons and do not wish to store options in the DB:-
Code:
function interests() {
$interests[1]='interest1';
$interests[2]='interest2';
$interests[3]='interest3';
$interests[4]='interest4';
return $interests;
}
In my controller, I access the options by calling the function:-
Code:
$this->load->library('profileoptions');
$interests = $this->profileoptions->interests();
All is fine up until there and I can output the array from the controller without any problem. However, how do I pass the array from the controller to the view using a simple expression like:-
Code:
$data['interests'] = isset($interests);
so that I can either create a FOR loop or display all the data at once using the most simplest syntax?
If I try to extract all the values from the array in the viewer, they do not appear.
Any help would be appreciated.
Thanks