title: Passing variable from controller to view in CodeIgniter
body: <p>I'm new to Codeigniter and OOP PHP.</p>
  
  <p>Controller:</p>
  
  <pre><code>public function index(){
      $this-&gt;load-&gt;model('main_model');
      $planet = $this-&gt;main_model-&gt;solar();
      $this-&gt;load-&gt;view('main_view', $planet);    
      }
  </code></pre>
  
  <p>If <code>echo $planet</code> in the controller it does what it's supposed to do.  If I <code>echo $planet</code> in the view I get an undefined variable error.  <code>$planet</code> is not an array.  Why isn't the <code>$planet</code> variable being passed to the view?</p>
  
  <p>I know this is a simple and basic question and I'm embarrassed that I can't figure out what I'm doing wrong.</p>
  
  <p>EDIT:  Okay, after more fiddling around, I got it to work.  Can variables only be passed from Controller to View when they're formatted as an array?</p>