Technically the referrer header is an optional part of the http spec, so cannot always be relied upon (though most browsers do behave, you may get issues with odd proxies misbehaving). The only really reliable way to do this is to tag the previous page in your session (best in a beforeFilter / afterRender) and use that. But yeah, for the majority of circumstances Chris's method would work fine.
Simon On Sep 1, 2:27 am, "Chris Hartjes" <[EMAIL PROTECTED]> wrote: > On 8/31/07, rtanz <[EMAIL PROTECTED]> wrote: > > > > > hi i would like to make a back button on some pages, how can i know > > the url of the previous page? thanks > > If you're in the controller, you can get the previous page via > $this->referer(). I use it all the time to send people back to the > page they were on before > > $this->redirect($this->referer()); > > -- > Chris Hartjes > Senior Developer > Cake Development Corporation > > My motto for 2007: "Just build it, damnit!" > > @TheBallpark -http://www.littlehart.net/attheballpark > @TheKeyboard -http://www.littlehart.net/atthekeyboard --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---