Welcome Guest, Not a member yet? Register   Sign In
How can i ignor this error massege
#1

[eluser]Rumel[/eluser]
How can i ignor this error:

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\CodeIgniter\system\application\controllers\basic.php:278)

Filename: libraries/Session.php

Line Number: 662

My controller is:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Basic Extends Controller {


public function Basic()
{
parent::Controller();
//$this->load->library('mySmarty');
$this->load->model('sample1','um');
$this->load->helper(array('form','url'));
$this->load->library('form_validation');
//$this->load->library('securimage');
$this->load->helper('url');
$this->load->helper('html');
$this->load->library('calendar');
$this->load->library('securimage');
$this->load->library('session');



}
function index()
{

//$this->load->model('test','um');
//$data=$this->um->test_table_show();
//$data['sample']=$this->sample->show();
//$this->mysmarty->assign('title',$data);
//$this->mysmarty->assign('content',"Hello!");

//$this->mysmarty->assign('test', 'Hello World.');
//$this->mysmarty->views('blog/sample'$title);
//}
//}


$data['user']=$this->um->show_event_title();

$this->load->view('home',$data);
//$this->mysmarty->display("basic.tpl");
}
function contact()
{
$this->load->view('contact');
}
function event()
{
$this->load->view('Latestevent');
}
function latest_even_title()
{
//$this->load->model('sample1','um');
$data['user']=$this->um->show_event_title();

$this->load->view('home',$data);
//$this->load->model('sample1','um');
//$data['tool']=$this->um->show_event_title();
//$this->load->view('home',$data);
}

function event_insert()
{
$this->um->event_inserts($_POST['title'],$_POST['category'],$_POST['detils']);
}

function contactinsert()
{
$this->form_validation->set_rules('name', 'Username','trim|required|min_length[5]|max_length[12]|xss_clean');
//$this->form_validation->set_rules('password', 'Password', 'trim|required|matches[passconf]|md5');
//$this->form_validation->set_rules('passconf', 'Password Confirmation', 'trim|required');
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');

if ($this->form_validation->run() == FALSE)
{
$this->load->view('contact');
}
else
{
$this->load->view('contact');
}


$inputCode = $_POST['imagecode'];
if($this->securimage->check($inputCode) == true)
{
$data['result'] = '<h1>=v= PASS!</h1>';
$this->um->contact_insert($_POST['name'],$_POST['email'],$_POST['subject'],$_POST['summary_text']);
//session_destroy();
$this->load->view('contact',$data);

//$this->load->view('templates/basic_insert.tpl',$data);
}
else
{
//echo 'Please retrype the captcha';
$data['result'] = '<h1>/_\ FAILURE</h1>';
//$this->load->view('templates/rumel',$data);
$this->load->view('contact',$data);
}

}
}
?&gt;
model is:
&lt;?php
class Sample1 extends Model{

function Sample1()
{
parent::model();

}
function test_table_show()
{
$query = $this->db->get('book_info_cse');
return $query->result();
}
function show_event_title()
{
//$this->db->select('title');

$query = $this->db->get('latesteven',8);
return $query->result();
}

function event_inserts()
{
$this->title =$_POST['title'];
$this->category=$_POST['category'];
$this->detils=$_POST['detils'];
$this->db->insert('latesteven',$this);
$this->load->view('Latestevent');
}
function delete()
{
$delete=$_POST['delete'];
for($i=0;$i<count($delete);$i++)
{
$this->db->where('id',$delete[$i]);
$this->db->delete('book_info_cse');
}
}

function contact_insert()
{
$this->name =$_POST['name'];
$this->email=$_POST['email'];
$this->subject=$_POST['subject'];
$this->summary=$_POST['summary_text'];
$this->db->insert('contact',$this);
$this->load->view('contact');

}




}

?&gt;
my view page is: <div id="m_bac"><h3>Recent post</h3></div>
<ul>
&lt;?php foreach ($user AS $row)
{
?&gt;
<li ><a href="#">&lt;?=$row->title?&gt;</a></li>

&lt;?php
}
?&gt;
</ul>


<div>
<div id="m_bac"><h3>Category</h3></div>
&lt;?php foreach ($user AS $row)
{
?&gt;
<li ><a href="#">&lt;?=$row->category?&gt;()</a></li>

&lt;?php
}
?&gt;

</div>
</div>
#2

[eluser]JuanitoDelCielo[/eluser]
You should't do that. This is a common error, the cause is that you are printing something before the headers... somtime its just a white space sometimes its a miss echo
#3

[eluser]InsiteFX[/eluser]
Add please use the forums code tags when listing source code!

InsiteFX
#4

[eluser]Rumel[/eluser]
Plese help me i don't ignor this error message.
A PHP Error was encountered
Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\CodeIgniter\system\application\controllers\basic.php:276)

Filename: libraries/Session.php

Line Number: 408

My controller is:&lt;?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Basic Extends Controller {


public function Basic()
{
parent::Controller();

$this->load->model('sample1','um');
$this->load->helper(array('form','url'));
$this->load->library('form_validation');
$this->load->helper('url');
$this->load->helper('html');
$this->load->library('calendar');
$this->load->library('securimage');


}
function index()
{

$data['user']=$this->um->show_event_title();

$this->load->view('home',$data);
}
function contact()
{
$this->load->view('contact');
}
function event()
{
$this->load->view('Latestevent');
}
function latest_even_title()
{
$data['user']=$this->um->show_event_title();

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

}
function event_insert()
{
$this->um->event_inserts($_POST['title'],$_POST['category'],$_POST['detils']);
}

function contactinsert()
{
$this->form_validation->set_rules('name', 'Username','trim|required|min_length[5]|max_length[12]|xss_clean');

$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');

if ($this->form_validation->run() == FALSE)
{
$this->load->view('contact');
}
else
{
$this->load->view('contact');
}


$inputCode = $_POST['imagecode'];
if($this->securimage->check($inputCode) == true)
{
$data['result'] = '<h1>=v= PASS!</h1>';
$this->um->contact_insert($_POST['name'],$_POST['email'],$_POST['subject'],$_POST['summary_text']);
//session_destroy();
$this->load->view('contact',$data);

//$this->load->view('templates/basic_insert.tpl',$data);
}
else
{
//echo 'Please retrype the captcha';
$data['result'] = '<h1>/_\ FAILURE</h1>';
//$this->load->view('templates/rumel',$data);
$this->load->view('contact',$data);
}

}




}
?&gt;
my view page is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
&lt;head&gt;

&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
&lt;title&gt;Home page&lt;/title&gt;
&lt;link rel="stylesheet" href="&lt;?php echo base_url(); ?&gt;css/home.css"
type="text/css" media="all"&gt;



&lt;style type="text/css"&gt;
&lt;!--
.style2 {
color: #996666;
font-weight: bold;
}
.style3 {font-family: "Courier New", Courier, monospace}
--&gt;
&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;
<div id="container">
<div id="header">
<div>&lt;embed src="http://www.respectsoft.com/onlineclock/ballclock.swf" width="120" height="120" align="right" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" wmode="transparent"&gt;&lt;/embed>
</div>
<h1 class="style3"> Make Difference....</h1>
<h1 align="center">F|T|Yahoo|Gmail</h1>


<ul id="nav">
<li class="h"><a href="&lt;?php echo site_url('basic/index')?&gt;">Home</a></li>
<li class="a"><a href=" &lt;?php echo site_url('basic/contact')?&gt;">Contact Page</a></li>
<li class="p"><a href="#">Photo galary</a></li>
<li class="c"><a href="#">About me</a></li>
</ul>



</div>

<div id="left_menu">
&lt;?php

echo $this->calendar->generate();
?&gt;
<div>
Some learning in CI
</div>
<ul>
<li ><a href="#">Link</a></li>
<li ><a href="#">Link</a></li>
<li ><a href="#">Lin</a></li>
</ul>
</div>

<div id="right_panel">
<p align="left"> &lt;form method="get" action="http://www.google.com/search"&gt;
&lt;input type="text" name="q" size="20" maxlength="255" value="" /&gt;
&lt;input type="submit" value="Search" /&gt;
&lt;/form&gt;
</p>
<div id="m_bac"><h3>Recent post</h3></div>
<ul>
&lt;?php foreach ($user AS $row)
{
?&gt;
<li ><a href="#">&lt;?php echo $row->title?&gt;</a></li>

&lt;?php
}
?&gt;
</ul>







<div>
<div id="m_bac"><h3>Category</h3></div>
&lt;?php foreach ($user AS $row)
{
?&gt;
<li ><a href="#">&lt;?=$row->category?&gt;()</a></li>

&lt;?php
}
?&gt;

</div>
</div>

<div id="middle_panel">
<div>Hi i am mainul islam. </div>
</div>
<br class="clearfloat" />
<div id="footer" align="center">Copyright &copy; 2010 By Mainul.</div>

&lt;/body&gt;
&lt;/html&gt;
#5

[eluser]WanWizard[/eluser]
Seen InsideFX's comment? Please use [ CODE ] tags! Posts like this are unreadable!.

The error says:
Quote:output started at C:\xampp\htdocs\CodeIgniter\system\application\controllers\basic.php:276

so that is where you have to look. I assume it's the last line of the file, and you have used a PHP closing tag ?&gt; there (which you shouldn't use as per CI coding standards), and some whitespace after that which generates the output.
#6

[eluser]Rumel[/eluser]
Thank you for this help.
Finally, i ignor this error message. only remove this(?&gtWink in controller .




Theme © iAndrew 2016 - Forum software by © MyBB