codeigniter - Page with multiple forms
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 a开发者_如何学Pythonny controller and return to the same url. thanks
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.
精彩评论