views:

187

answers:

1

Hi, I'm new to codeigniter this is my case: I have a homepage with a list of items, I can navigate through pagination, but I have in my sidebar a login form, it's possible to return to the same page after try to login in the case that is valid or not with a validation message. for the login option I have a controller and login function but I don't know what view load after validation. I need to login in any controller and return to the same url. thanks

+1  A: 

All your login forms should post to the same Login controller, which can then redirect the user back to the referring URL.

My personal approach is to remember the last "memorable" page (i.e. worth remembering) the user visited as a session variable. For example, I remember that the user visited the home/contact/products pages, but not the login/signup/404/tos/privacy/etc pages. After a successful login, the Login controller can redirect the user to the last memorable URL.

Dolph