0

I am getting this error only: My redirection code is:

$this->session->set_flashdata('site_flash', '<div class="alert alert-success">Thank you for registering with us.</div>');
redirect(site_url('site/complete_registration'));

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/btcearning/public_html/login/system/core/Exceptions.php:271)

Filename: controllers/Site.php

Line Number: 279

Backtrace:

File: /home/btcearning/public_html/login/application/controllers/Site.php Line: 279 Function: header

File: /home/btcearning/public_html/login/index.php Line: 224 Function: require_once

Naim Malek
  • 1,186
  • 1
  • 11
  • 21
Haren Sarma
  • 2,267
  • 6
  • 43
  • 72
  • 1
    try 'redirect(base_url('site/complete_registration'));' – Rajeev Radhakrishnan Oct 26 '17 at 08:43
  • You may need to set some routes https://www.codeigniter.com/user_guide/general/routing.html#examples and it also may be you need to have a new htaccess. also try like `redirect(base_url('site/complete_registration'))` make sure you have set the base url in config.php –  Oct 26 '17 at 08:54

1 Answers1

1

No need to used site_url() or base_url().

Simply used like:

$this->session->set_flashdata('item','value');
redirect('controller/function');

It will work. refer this link: https://www.tutorialspoint.com/codeigniter/codeigniter_flashdata.htm

Chaitanya Desai
  • 333
  • 3
  • 17