1

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 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.