How can i ignor this error massege - 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: How can i ignor this error massege (/showthread.php?tid=33869) |
How can i ignor this error massege - El Forum - 09-11-2010 [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); } } } ?> model is: <?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'); } } ?> my view page is: <div id="m_bac"><h3>Recent post</h3></div> <ul> <?php foreach ($user AS $row) { ?> <li ><a href="#"><?=$row->title?></a></li> <?php } ?> </ul> <div> <div id="m_bac"><h3>Category</h3></div> <?php foreach ($user AS $row) { ?> <li ><a href="#"><?=$row->category?>()</a></li> <?php } ?> </div> </div> How can i ignor this error massege - El Forum - 09-11-2010 [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 How can i ignor this error massege - El Forum - 09-11-2010 [eluser]InsiteFX[/eluser] Add please use the forums code tags when listing source code! InsiteFX How can i ignor this error massege - El Forum - 09-12-2010 [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:<?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); } } } ?> my view page is: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html > <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Home page</title> <link rel="stylesheet" href="<?php echo base_url(); ?>css/home.css" type="text/css" media="all"> <style type="text/css"> <!-- .style2 { color: #996666; font-weight: bold; } .style3 {font-family: "Courier New", Courier, monospace} --> </style> </head> <body> <div id="container"> <div id="header"> <div><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"></embed> </div> <h1 class="style3"> Make Difference....</h1> <h1 align="center">F|T|Yahoo|Gmail</h1> <ul id="nav"> <li class="h"><a href="<?php echo site_url('basic/index')?>">Home</a></li> <li class="a"><a href=" <?php echo site_url('basic/contact')?>">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"> <?php echo $this->calendar->generate(); ?> <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"> <form method="get" action="http://www.google.com/search"> <input type="text" name="q" size="20" maxlength="255" value="" /> <input type="submit" value="Search" /> </form> </p> <div id="m_bac"><h3>Recent post</h3></div> <ul> <?php foreach ($user AS $row) { ?> <li ><a href="#"><?php echo $row->title?></a></li> <?php } ?> </ul> <div> <div id="m_bac"><h3>Category</h3></div> <?php foreach ($user AS $row) { ?> <li ><a href="#"><?=$row->category?>()</a></li> <?php } ?> </div> </div> <div id="middle_panel"> <div>Hi i am mainul islam. </div> </div> <br class="clearfloat" /> <div id="footer" align="center">Copyright © 2010 By Mainul.</div> </body> </html> How can i ignor this error massege - El Forum - 09-12-2010 [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 ?> there (which you shouldn't use as per CI coding standards), and some whitespace after that which generates the output. How can i ignor this error massege - El Forum - 09-12-2010 [eluser]Rumel[/eluser] Thank you for this help. Finally, i ignor this error message. only remove this(?> in controller . |