views:

709

answers:

1

Hello everyone, i am new to php and CodeIgniter. I am currently studying the tutorials.

My controller blog.php is

<?php

class Blog extends Controller{
   function index()
   {
   $data['title'] = "My Blog Title";
   $data['heading'] = "My Blog Heading";
   $data['todo'] = array('clean house','eat lunch','call mom');

   $this->load->view('blog_view');
   }
}
?>

And my view blog_view.php is

My php errors are

Message: Undefined variable: heading Filename: views/blog_view.php Line Number: 6

Message: Undefined variable: todo Filename: views/blog_view.php Line Number: 10

Message: Invalid argument supplied for foreach() Filename: views/blog_view.php Line Number: 10

Any help will be much appreciated Thanks N

+9  A: 

You need to pass your $data variable to the view:

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

TheFella
Thank you-works fine!
make sure to mark this question as answered!
jmccartie