CodeIgniter Forums
Sesion already sent problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Sesion already sent problem (/showthread.php?tid=13107)



Sesion already sent problem - El Forum - 11-11-2008

[eluser]new developer[/eluser]
I have a problem saying session headers already sent. I worked the same code on Wamp but i installed Xampp recently. It gives me an error. My code is really simple as below. Can anyone please help me rectify this.
Code:
<?php

class Welcome extends Controller {

    function Welcome()
    {
        parent::Controller();    
    }
    

    function index(){
    $data['main'] = 'adminLogin';
      $data['title']= 'Welcome to my first aplication';
    $this->load->vars($data);
    $this->load->view(dashboard);
    }

      function verifyMe(){
      if($this->input->post('username')){
      $u = $this->input->post('username');
      $p = $this->input->post('password');
      $this-> MAdmins-> verifyUser($u,$p);
    if ($_SESSION['userid'] > 0){
    redirect('admin/dashboard','refresh');
    }
    }
         $this-> session-> set_flashdata(error  , 'Login failed');
       $this->load->view(adminLogin);
      }
}

?>



Sesion already sent problem - El Forum - 12-30-2008

[eluser]jwindhorst[/eluser]
I don't know if this is still relevant, but I was having a similar problem for a while this morning. My issue was a blank link under my closing php tag at the end of my user_model.php file. For some reason that blank line got rendered as display data and those the headers were thrown.


Sesion already sent problem - El Forum - 12-30-2008

[eluser]danielnexterous[/eluser]
I would go with jwindhorst.
I don't see anything else where you are sending any data to the browser that would cause the error.
Make sure there's no white space anywhere after the PHP closing or opening tags.


Sesion already sent problem - El Forum - 12-30-2008

[eluser]simshaun[/eluser]
That's why I follow CodeIgniter's footsteps and don't use a closing ?> tag in my controllers, libraries, models, hooks, etc..

The only place I use the closing tag is in my views (if my views contain php).