EllisLab text mark
Advanced Search
     
redirect doesn’t work
Posted: 28 January 2010 09:07 AM   [ Ignore ]
Joined: 2009-10-30
73 posts

function add_vacancy()
  {
      $this->load->helper(‘url’);
      $this->load->model(‘officer/officer_vacancy’);
      $user[‘user_id’]  = $this->session->userdata(‘email’);     
      $user[‘user_group’] = $this->redux_auth_model->getUserGroupByUserId($user[‘user_id’]);       
      echo $new_user_id = $this->officer_vacancy->create_new_user($user);     

      redirect(’/officer/officer_vacancy/new_vacancy’, ‘refresh’);
  }

This is my function. ‘officer’ is the sub folder inside the controller folder. Following is the error

A PHP Error was encountered
Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at D:\xampp\htdocs\Mycareergate3\system\application\controllers\officer\home.php:17)

Filename: helpers/url_helper.php

Line Number: 528

Please help me to solve this problem

 
Posted: 28 January 2010 09:41 AM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2009-07-15
405 posts

Post here 528 line of url_helper.php and your model code. And please, wrap your code in replies with code BB tag. It will be better to read.

 
Posted: 28 January 2010 10:03 AM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2008-01-03
728 posts

The solution is right there smile

This error is for example shown when ever you try to redirect to another page but do have output before that.
In your case you try to redirect

redirect(/officer/officer_vacancy/new_vacancy’‘refresh’); 

but befor that you echo $new_user_id

echo $new_user_id $this->officer_vacancy->create_new_user($user); 

Remove the echo and it should be fine.

 Signature 

Blog - Twitter

DBlog

MeNeedz: Auth - Cloud - Password - Search - Shoutbox - Akismet -
Twitter - Visitor tracking

 
Posted: 28 January 2010 10:05 AM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2010-01-28
101 posts

double thread.

http://ellislab.com/forums/viewthread/143446/

 Signature 

Text written by Rob
don’t follow me ^_^

 
Posted: 28 January 2010 02:03 PM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Avatar
Joined: 2008-11-28
148 posts

You must use Redirect before you send headers (data ‘echo’) to browser.

 Signature 

Enough work has cost to me commit my sins
To devalue them in vain regrets.

 
Posted: 28 January 2010 11:57 PM   [ Ignore ]   [ # 5 ]   [ Rating: 0 ]
Joined: 2009-10-30
73 posts

Thanx all. I removed ‘echo’ and now it is working finely. Thanx a lot. May god bless all of you