0

I know that we can send a variable to the next page with session, however I want to know if we can send it more than 2 pages forward.

session_start();
$_SESSION['varname'] = $username_sim ;

In a code like this one with the varname we can take the data in the next page as this but can we do it in a possible third page with out using session in the second page??

session_start();
$var_value = $_SESSION['varname'];
  • 2
    You can send it to 50 if you want. Just as long as the session's still set throughout all pages (using sessions). *"but can we do it in a possible third page with out using session in the second page?"* - No. *The buck stops here*. – Funk Forty Niner Apr 09 '15 at 17:08
  • You're welcome. However, this Q&A http://stackoverflow.com/q/13102489/ may also be of help. *I'm the man on the ♫ Silver Mountain* ;-) I got my Strat to keep me company. – Funk Forty Niner Apr 09 '15 at 17:14
  • bro if you want I can select you answer but you have to do it on the answers part –  Apr 14 '15 at 08:20

1 Answers1

1

"I know that we can send a variable to the next page with session, however I want to know if we can send it more than 2 pages forward."

You can keep using the same session array for as many pages as you want, just as long as all pages keeps the session alive and that the session array is set and not empty.

"...but can we do it in a possible third page with out using session in the second page?"

That isn't possible. That is what sessions are for.


Community
  • 1
  • 1
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141