Question

I have two pages: bookings/index and users/myUserAccount that have a link to locations/add. What I want is that after I save the form for locations/add I want to go back to the page that refered this one. If I am in myUserAccount, click locations/add, I complete the form, save my location and I want to go back to myUserAccount. What would it be a good solution to do this? I tried with cakephp's function $this->referer(). When I get in locations/add page the referer shows me the last page, but when I press save it has to go again through my add action from location controller and my referer changes now to locations/add.

Was it helpful?

Solution

you can store your referer in a session variable the firt time you arrive in your locationsController->view() and retrieving it when you actually pass data to the controller

or you can pass a parameter in your link to decide whether your are coming from users/myUserAccount or from bookings/index i.e.

locations/add/referer:user

or

locations/add/referer:bookings
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top