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

[eluser]Corbee[/eluser]
I inserted this to my controller
Code:
if (!($this->input->post('form_token')))
{
    echo "Invalid Submission... redirecting to Registration Page";
    redirect('register/index','refresh');
    return false;
}

and got an error
Code:
A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at C:\ampp\htdocs\insurance1\application\controllers\register.php:23)

Filename: helpers/url_helper.php

Line Number: 539

Whenever I remove the redirect, it works, but I kinda need it.

Why is it not working, where did I go wrong?
#2

[eluser]Maglok[/eluser]
You are echoing something before the redirect. The redirect is a header redirect, which need to be sent before any output. Remove the echo, since it would just end up not being shown since it will immediately redirect.

If you still want to use a status message, look into flashdata (see user guide).
#3

[eluser]Corbee[/eluser]
Oh, thanks
#4

[eluser]meemeo[/eluser]
thanks : Maglok

I'm register for thanks you

thank angin




Theme © iAndrew 2016 - Forum software by © MyBB