4 Replies - 757 Views - Last Post: 18 July 2009 - 09:51 PM Rate Topic: -----

#1 vikas_naranje  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 34
  • Joined: 23-January 09

session variable

Posted 18 July 2009 - 04:04 AM

I'm making web application in which i want to use session to track the user activity.
session_start();
session_register("name");
$_SESSION['NAME']="SOME VALUE";


it's working fine in same page but problem is that i'm not able to use this session variable in next page or anywhere in my site.

it's show that this session variable is no set, accept in which it has been define.


what should i do. please send some concept. it's urgent!

Is This A Good Question/Topic? 0
  • +

Replies To: session variable

#2 ghqwerty  Icon User is offline

  • if($spareTime > 0){ $this->writeCode(); }
  • member icon

Reputation: 43
  • View blog
  • Posts: 903
  • Joined: 08-August 08

Re: session variable

Posted 18 July 2009 - 05:12 AM

where are you trying to use it ? have you got session_start() on every page that you wish to use it on ?
Was This Post Helpful? 1
  • +
  • -

#3 przemass  Icon User is offline

  • D.I.C Head

Reputation: 30
  • View blog
  • Posts: 166
  • Joined: 18-July 09

Re: session variable

Posted 18 July 2009 - 09:59 AM

You don't have to use
session_register("name");



Try this:
- setting variable
session_start();
$_SESSION['NAME'] = 'SOME VALUE';



- reading varialbe
session_start();
var_dump($_SESSION['NAME']);


Was This Post Helpful? 0
  • +
  • -

#4 ghqwerty  Icon User is offline

  • if($spareTime > 0){ $this->writeCode(); }
  • member icon

Reputation: 43
  • View blog
  • Posts: 903
  • Joined: 08-August 08

Re: session variable

Posted 18 July 2009 - 11:20 AM

session register was old syntax

Warning

This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged.
Was This Post Helpful? 0
  • +
  • -

#5 noorahmad  Icon User is offline

  • Untitled
  • member icon

Reputation: 209
  • View blog
  • Posts: 2,290
  • Joined: 12-March 09

Re: session variable

Posted 18 July 2009 - 09:51 PM

for better solution and error controlling try this code
if(!isset($_SESSION))
{
session_start();
}

$_SESSION['name']='some value';

echo $_SESSION['name'];

Was This Post Helpful? 1

Page 1 of 1