Welcome Guest, Not a member yet? Register   Sign In
redirecting to previous page
#3

[eluser]Mirage[/eluser]
I would not use HTTP_REFERER because it's not reliable.

As usual there are multiple ways to do this and it depends how generic you want it to be.

For forms, it's not too unusual to pass return urls as a query parameter or a hidden form field.

If you need to be able to reliably track 'every' page, because your link is in the header or something you would need to store it more generically.

For that you could set a session variable on every page visit, but that would potentially negate usage of the powerful caching feature in CI and could thus be expensive.

Another option is to store the return page in a Cookie. You can do that early in the command chain, e.g. your index.php or hook. Or you can do it in JavaScript and thus less expensive - but limited to browsers with Javascript enabled. Which is pretty much a given these days.

Hope this helps,
-m


Messages In This Thread
redirecting to previous page - by El Forum - 09-05-2008, 10:58 PM
redirecting to previous page - by El Forum - 09-08-2008, 07:04 AM
redirecting to previous page - by El Forum - 09-08-2008, 07:20 AM
redirecting to previous page - by El Forum - 09-08-2008, 07:30 AM
redirecting to previous page - by El Forum - 09-09-2008, 08:05 AM



Theme © iAndrew 2016 - Forum software by © MyBB