Welcome Guest, Not a member yet? Register   Sign In
Message Cannot modify header information - headers already sent
#17

[eluser]thephpx[/eluser]
Hi guys,

Do not know if it will help or not but I was getting the same kinda error.
<-- CODE START --&gt;
function addlession(){
$this->template->type('back');
$this->template->set('admin');
$this->template->load('top', $page);
$this->template->load('lessonsadd', $page);
$this->template->load('bottom');

if(count($_POST) > 1)
{
//do things.
}
}
<-- CODE END --&gt;

upon posting the values to this same function it was showing "Cannot modify header information - headers already sent by...". Loading the template files after the if statement seems to fixed this problem.

In my case it happened because the header was already sent while parsing the templates, not because of any white-space but yes 99% case it happens because of 1 extra line before &lt;?php or after ?&gt; tag.

So to solve this issue I loaded the templates after the if statement Smile

<-- CODE START --&gt;
function addlession(){
$this->template->type('back');
$this->template->set('admin');

if(count($_POST) > 1)
{
//do things.
}
$this->template->load('top', $page);
$this->template->load('lessonsadd', $page);
$this->template->load('bottom');
}
<-- CODE END --&gt;

take care,

faisal


Messages In This Thread
Message Cannot modify header information - headers already sent - by El Forum - 02-22-2009, 03:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB