1

Possible Duplicate:
How do I continue a session from one page to another with PHP

I have this $_SESSION:

$_SESSION['user']['id'];

How can I send this, to another page with PHP?

Community
  • 1
  • 1
Oliver 'Oli' Jensen
  • 2,631
  • 9
  • 26
  • 40

1 Answers1

9

You do not need to "send" anything. $_SESSION is repopulated on each request when you call session_start() based on the session identifier in the PHPSESSID cookie sent by the browser.

Page A:

session_start();
$_SESSION['user']['id'] = 3;

Page B:

session_start();
echo "User ID is: " . $_SESSION['user']['id']; //prints 3
Dan Grossman
  • 51,866
  • 10
  • 112
  • 101