Welcome Guest, Not a member yet? Register   Sign In
User registration completes, but crashes
#1

[eluser]Unknown[/eluser]
Hey guys,

I'm using the Users Library (http://codeigniter.com/wiki/Users_Library/) to make a very simple registration page so that I can create users and then direct them to the registration complete page. Currently, the function completes and the new user is entered into the database, but the resulting redirect fails.

Fatal error: Call to undefined function redirect() in /home/steve248/public_html/dev/system/application/controllers/user.php on line 76

Line 76 is the redirect statement that runs after the user has been registered:
Code:
if(!$this->users->register($username,$password,$email))
            {
                $error = $this->users->last_error;
            }
            else
            {
                redirect('user/registered');
            }

And I'm assuming user/registered goes to the registered() function within the same controller:
Code:
function registered()
    {
        $data = array(
            'header_img'=>'header_logo.gif',
            'show_nav'=>false
            );
        $output = $this->load->view('common/header', $data, true);
        $output .= $this->load->view('user/registered', $data, true);
        $output .= $this->load->view('common/footer', $data, true);
        
        $this->output->set_output($output);
    }

A user/registered view page also exists. All it says right now is that the action has successfully completed.

So if anyone can see maybe what I'm doing wrong or can point me in the right direction, I'd appreciate it.

Thanks,
Steve
#2

[eluser]Unknown[/eluser]
And for those looking and wondering as well, I've solved it... and it's a simple solution at that. Don't forget to include your helpers! Wink

Code:
$this->load->helper('url');




Theme © iAndrew 2016 - Forum software by © MyBB