Routing Question - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Routing Question (/showthread.php?tid=68998) |
Routing Question - ironPotato - 09-25-2017 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? RE: Routing Question - InsiteFX - 09-26-2017 Did you try a redirect to it? RE: Routing Question - ironPotato - 09-26-2017 (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. RE: Routing Question - dave friend - 09-26-2017 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) |