title: CodeIgniter appending to the beginning of the view when it shouldn't be
body: <p>When I call regularDashboard(), it appends to the beginning of my view. In my view I'm calling $reg from inside a formatted style. So it shouldn't be echoing out at the beginning of the view... Any ideas as to why this is happening?</p>
  
  <pre><code>public function dcr() {
          // pass all dashboard accesses through this function
          $username = $this-&gt;session-&gt;userdata("username");
          $query = $this-&gt;db-&gt;get_where('users', array('username' =&gt; $username));
          $userType = $this-&gt;session-&gt;userdata('userType');
          if ($userType == 'regular') {
                  foreach ($query-&gt;result() as $row) {
                      $data = array('reg' =&gt; $this-&gt;regularDashboard(), 'firstname' =&gt; $row-&gt;firstname);
                      $this-&gt;load-&gt;view('dashboard', $data);
  } public function regularDashboard () {
              $userid = $this-&gt;session-&gt;userdata('userid');
              $results = $this-&gt;db-&gt;query("SELECT * FROM users");
              foreach ($results-&gt;result() as $row) {
                  if($userid != $row-&gt;userid) {
                      echo $row-&gt;firstname . " " . $row-&gt;lastname;
                      echo "&lt;form method='GET' action='processing/lib/process-send-friend-request.php?'&gt;";
                      echo '&lt;input name="accepted" type="submit" value="Send User Request" /&gt;&lt;br /&gt;';
                      echo '&lt;input name="AddedMessage" placeholder="Add a message?" type="textbox" /&gt;';
                      echo '&lt;br&gt;Select Friend Type: ' . '&lt;br /&gt;Full: ';
                      echo '&lt;input name="full_friend" type="checkbox"';
                      echo '&lt;input type="hidden" name="id" value="' . $row-&gt;idusers . '" /&gt;';
                      echo '&lt;/form&gt;';
                      echo "&lt;br /&gt;&lt;hr /&gt;";
                  } elseif ($userid == $row-&gt;userid) {
                      echo $row-&gt;firstname . " " . $row-&gt;lastname;
                      echo "&lt;br /&gt;";
                      echo "You all are currently friends";
                  }
         }
  }
  </code></pre>