Routing Question |
Hi guys.
I am trying to build some sort of registration/login thing with CodeIgniter. This is my first attempt so please let me know if you spot something outside the original issue. I have the registration form's action set to 'register/register_process' The register_process only takes care of checking if the username already exists, and creating if the user if it doesn't exist. At the end of the register_process method, I am telling it to load the dashboard view like so PHP Code: /** Username exists. */ The thing is, when the user gets created and the congratulations view is loaded, the URL says localhost/sitename/register/register_process. How do I make it show localhost/sitename/register/congratulations instead?
Did you try a redirect to it?
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(09-26-2017, 03:12 AM)InsiteFX Wrote: Did you try a redirect to it? Oh yes. I did something like PHP Code: redirect(base_url().'register/congratulations'); If I remember it correctly. But I wanted to pass some data in an array via PHP Code: $this->load->view('register/congratulations', $data); The other thing I read about was to try using flash sessions (forgot the correct name, although I did read the docs about it) along with the redirect to pass session variables instead.
You could pass the user name to congratulations during the redirect
PHP Code: redirect(base_url("register/congratulations/$username")); Revised congratulations method PHP Code: public function congratulations($username) |
Welcome Guest, Not a member yet? Register Sign In |