Php or any server side scripting experts suggestions needed. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Php or any server side scripting experts suggestions needed.

I'm trying to redirect session from one page to another but while redirecting the session has been lost that's why I needed some reason so how could we resolve this problem I want the session to be created and to be used on every pages where ever I can use wherever I need it but on the same page I am getting the session but on another page the session has been lost after redirection can anyone suggest me how to resolve with this problem if you have any suggestions you are most welcome. Thank you..

22nd Jun 2017, 2:38 PM
Saurav Sony
Saurav Sony - avatar
7 Answers
+ 2
create a php file and declare sessions variable at there. wherever you want to use it . just import to another page
24th Oct 2017, 3:52 AM
林偉雄
林偉雄 - avatar
+ 2
Thanks for your reply dude.. But i have done it..
24th Oct 2017, 4:32 AM
Saurav Sony
Saurav Sony - avatar
+ 1
On the other pages, did you start the session? session_start();
22nd Jun 2017, 2:51 PM
AgentSmith
+ 1
On your other page, where it isn't working, put this in your code and see what results it returns when you refresh the page. Post them here. This will print out the session array so we can see if it's there or not. echo '<pre>'; print_r($_SESSION); echo '</pre>';
22nd Jun 2017, 2:54 PM
AgentSmith
+ 1
It's redirecting to another page on your domain? Also, have you already written code to destroy the session? It may be triggering the session to be destroyed. Hard to say without having any of the code posted here.
22nd Jun 2017, 2:57 PM
AgentSmith
0
yes dear.. but even after that i didn't get..
22nd Jun 2017, 2:50 PM
Saurav Sony
Saurav Sony - avatar
0
i checked the session created or not by doing this bro but getting on the process page where created but not on the other page where i havr redirected..
22nd Jun 2017, 2:54 PM
Saurav Sony
Saurav Sony - avatar