Welcome Guest, Not a member yet? Register   Sign In
Redirect
#1

[eluser]maniac[/eluser]
I am very new to codeigniter and having problems using redirect(). Hope someone can help me.
I have an employee database that needs to offer delete etc and am just trying to do the delete, but keep coming up with an error when 'delete' is selected. When the page is re-loaded the name is deleted, but doesn't redirect back to the page, just an error.
I keep getting -

'Message: Cannot modify header information - headers already sent by (output started at X:\www\mvc2\system\application\models\employee_model.php:27)
Filename: helpers/url_helper.php
Line Number: 541'

My code -
View file
<td>&lt;?=anchor('emps/delete_employee/'.$row->empid,'Delete');?&gt;</td>
Model file
function delete_employee()
{
$this->db->query('delete from tblemployee where empid = "'.$this->uri->segment(3).'"');
}
Controller
function delete_employee()
{
$this->employee_model->delete_employee();

redirect('employee/index');

Hope someone can tell me what I am doing wrong.
Thanks.
#2

[eluser]InsiteFX[/eluser]
Check for white space before and after your PHP tags.

Also try just redirecting to employee without the
index, you may need to add the second parameter to
the redirct refresh.

Enjoy
InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB