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

[eluser]anna16[/eluser]
Hi guys

How do i fix this error below?
http://www.coder9.com/ci/crud.php/welcome/contactus

This is the controller welcome.php
Code:
<?php
class Welcome extends Controller {

    function Welcome(){
        parent::Controller();
    }
    
    function index(){
        $this->load->helper('form');
        $data['title'] = "Welcome to our Site";
        $data['headline'] = "";
        $data['include'] = 'home';
        $this->load->vars($data);
        $this->load->view('template');
    }
    
    function contactus(){
        $this->load->helper('url');
        if ($this->input->post('email')){
            $this->load->model('MContacts','',TRUE);
            $this->MContacts->addContact();
            redirect('welcome/thankyou','refresh');
        }else{
            redirect('welcome/index','refresh');
        }
    }
    
    function thankyou(){
        $data['title'] = "Thank You!";
        $data['headline'] = "Thanks!";
        $data['include'] = 'thanks';
        $this->load->vars($data);
        $this->load->view('template');    
    }
}

/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */

This is the model below mcontacts.php
Code:
<?php
class MContacts extends Model{

    function MContacts(){
        parent::Model();
    }

     function addContact(){
        $now = date("Y-m-d H:i:s");
        $data = array(
            'name' => $this->input->xss_clean($this->input->post('name')),
            'email' => $this->input->xss_clean($this->input->post('email')),
            'notes' => $this->input->xss_clean($this->input->post('notes')),
            'ipaddress' => $this->input->ip_address(),
            'stamp' => $now
        
        );

        $this->db->insert('contacts', $data);    
     }
}
?>

I hope someone can give me good advice for this.
Thank you in advanced.


Messages In This Thread
Cannot modify header information - headers already sent by...? - by El Forum - 09-25-2010, 09:43 PM



Theme © iAndrew 2016 - Forum software by © MyBB