Hi i have a very simple question . I have a home page it will open with a pop up to choose a region ex: chennai
, delhi
, banglore
, etc.. once a user select any region it will go to the separate pages. But now what i need is if user click back button or try to go home page he need to go the selected regions previously. For simple to understand user can redirect from home page to previous page using cookies or any other options please help me thanks in advance.
Asked
Active
Viewed 582 times
0

Niranjan N Raju
- 12,047
- 4
- 22
- 41

Karthick
- 73
- 1
- 1
- 10
-
Where is your code? Where in specifci are you stuck in said code? – PeeHaa Oct 15 '15 at 09:47
-
not any code is there still right now i need to know it is possible to do user can redirect from home page to previous page using cookies or any other options – Karthick Oct 15 '15 at 09:50
2 Answers
0
At the homepage, check if there is a session value for "region" like isset($_SESSION['region'])
. IF not then display the popup to select the region.
When the region is selected, redirect to that region page and set $_SESSION['region'] = 'regionName';
Now when user comes to homepage, our first condition which is isset($_SESSION['region'])
will be checked and if true will redirect to that region page. So there wont be any use of cookies as such. But still if you want to use cookies, You can use the same logic to check if value exists in cookies then redirect to that region page else show popup.

Ashish Choudhary
- 2,004
- 1
- 18
- 26
0
You can't change the behaviour of the "back-button" in browsers.
It's possbile to do this with anchors e.g. site.com/#blabla
or sessions (php)

Sebastian Schneider
- 4,896
- 3
- 20
- 47
-
can u tell me how i get this #blabla variable to store in a sessions at home page and redirect to any specific url? – Karthick Oct 15 '15 at 09:53
-
-
more: http://stackoverflow.com/questions/2317508/php-get-value-from-url-after-sign – Sebastian Schneider Oct 15 '15 at 09:58
-
-
Hi sese schneider those concept will work on local host? else i need to check it after uploaded in server? – Karthick Oct 15 '15 at 10:19