Author Topic: How do I name a session and then use it?  (Read 123 times)

0 Members and 1 Guest are viewing this topic.

Offline m0v0nageTopic starter

  • Irregular
    • View Profile
How do I name a session and then use it?
« on: February 08, 2010, 08:29:55 PM »
How do I name a session and then give it variables? Let's say I want a session named foo and want to give it a variable called "MyName" that is equal to "Matt". Then let it be accessed on any page with a session_start();

How do I do this?

Offline teamatomic

  • Devotee
  • Gender: Male
  • fat skis rule!
    • View Profile
    • myPHPtemplate
Re: How do I name a session and then use it?
« Reply #1 on: February 08, 2010, 08:46:32 PM »
Code: [Select]
page1.php

session_name('foo);
session_start();
$_SESSION['MyName']='Matt';


page2.php
session_name('foo);
session_start();
$name = $_SESSION['MyName']


HTH
Teamatomic
when in doubt...ski fast
when scared...ski faster
when terrified...point em down

PHP Freaks Forums

« on: »

Tired of these ads? Purchase a supporter subscription to get rid of them.