Welcome Guest, Not a member yet? Register   Sign In
redirect doesn't work
#1

[eluser]max123[/eluser]
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
#2

[eluser]Sbioko[/eluser]
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.
#3

[eluser]davidbehler[/eluser]
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
Code:
redirect(’/officer/officer_vacancy/new_vacancy’, ‘refresh’);
but befor that you echo $new_user_id
Code:
echo $new_user_id = $this->officer_vacancy->create_new_user($user);

Remove the echo and it should be fine.
#4

[eluser]Rob Gordijn[/eluser]
double thread.

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

[eluser]OliverHR[/eluser]
You must use Redirect before you send headers (data 'echo') to browser.
#6

[eluser]max123[/eluser]
Thanx all. I removed 'echo' and now it is working finely. Thanx a lot. May god bless all of you




Theme © iAndrew 2016 - Forum software by © MyBB