title: CodeIgniter : Undefined variable
body: <p>i have this problem</p>
  
  <blockquote>
    <p>A PHP Error was encountered</p>
    
    <p>Severity: Notice</p>
    
    <p>Message: Undefined variable: title</p>
    
    <p>Filename: views/content_home.php</p>
    
    <p>Line Number: 15</p>
  </blockquote>
  
  <p>and </p>
  
  <blockquote>
    <p>A PHP Error was encountered</p>
    
    <p>Severity: Notice</p>
    
    <p>Message: Undefined variable: text1</p>
    
    <p>Filename: views/content_home.php</p>
    
    <p>Line Number: 16</p>
  </blockquote>
  
  <p>here my view: </p>
  
  <pre><code>&lt;div id="content"&gt;
  &lt;?php
  
  
      foreach($results as $row){
              $title = $row-&gt;title;
              $text1 = $row-&gt;text1;
              $text2 = $row-&gt;text2;
              $text3 = $row-&gt;text3;
              $text4 = $row-&gt;text4;
      }
  
      ?&gt;
      &lt;div id="leftHome"&gt;
              &lt;h1&gt;&lt;?php echo $title; ?&gt;&lt;/h1&gt;
              &lt;p&gt; &lt;?php echo $text1; ?&gt; &lt;/p&gt;
              &lt;p&gt;&lt;?php echo $text2; ?&gt;&lt;/p&gt;        
      &lt;/div&gt;
      &lt;div id="rightHome"&gt;
              &lt;h1&gt;&lt;?php echo $text3; ?&gt;&lt;/h1&gt;
              &lt;ul&gt;
                  &lt;li&gt;&lt;a href="&lt;?php echo base_url()?&gt;site/food"&gt;&lt;?php echo $text4; ?&gt;&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>here my controller :</p>
  
  <pre><code>public function home(){
      $this-&gt;load-&gt;model("model_get");
      $data["results"] = $this-&gt;model_get-&gt;getData("home");  
      $this-&gt;load-&gt;view("site_header");
      $this-&gt;load-&gt;view("site_nav");
      $this-&gt;load-&gt;view("content_home", $data);
      $this-&gt;load-&gt;view("site_footer");
      }
  </code></pre>
  
  <p>and here my model</p>
  
  <pre><code>&lt;?php
  
  class Model_get extends CI_Model{
      function getData($page){
          $query = $this-&gt;db-&gt;get_where("pageData", array("title" =&gt;$page));
          return $query-&gt;result();
      }
  }
  </code></pre>
  
  <p>all text1 - text4 is undefined too. im new to codeigniter, i try anything but still cant find the problem. please help me with this.</p>