I have two function in one codeigniter controller which will set the payment status of user and send email. one main function will call send_mail. send_mail function will returns true or false. then in that main function, user will be redirected
here's the code..
function send_emai($id){
..
..
return $this->email->send();
}
function set_paid(){
//set paid to user data
$paid=$this->admin_model->set_paid($id_user);
..
..
$sent=$this->send_email($id_user);
if($paid && $sent){
$this->session->set_flashdata('status',
array(
'color'=>'green',
'message'=>'status paid<br/>Payment Confirmation Email sent'));
}
else{
$this->session->set_flashdata('status',
array(
'color'=>'green',
'message'=>'Booth status not paid<br/>Payment Confirmation Email not sent'));
}
redirect(admin/myclass/myfunction);
}
The errors i've got were
Cannot modify header information - headers already sent by (output started at C:\...\core\Exceptions.php:185)
Filename: libraries/Session.php
and this one.
Cannot modify header information - headers already sent by (output started at C:\...\core\Exceptions.php:185)
Filename: helpers/url_helper.php
I assumed this is because $this->send->email()
. If I omitted that send function
I could get redirected to the page and get notification set by session.
So, what can I do with this?