Codeigniter: la transmission des données de contrôleur pour afficher

Je veux passer $data à partir du contrôleur nommé poll à la results_view cependant, je suis d'une variable non définie erreur.

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Poll extends CI_Controller {

    public function __construct()
       {
            parent::__construct();
            $this->load->database();
            $this->load->helper('form');
       }

    public function index()
    {

        $this->load->view('poll_view',$data);
    }

    public function vote()
    {
        echo "Voting Successfull";
        $this->db->insert('votes',$_POST);
    }

    public function results()
    {
        echo "These are the results";
        //$query = $this->db->get('votes');
        $data = "hello";
        $this->load->view('results_view', $data);

    }
}

Results_view.php

<html>
<?php echo $data; ?>
</html>
  • $data devrait être la matrice de pas variable
InformationsquelleAutor Andrew Lynch | 2012-02-25