<?php
session_start();
if ( !isset($_session['memberId']))
{
header( 'Location: http://google.com' ) ;
}
else
{
//Blah blah
}
In the previous page i have set the member Id but here it cannot view as the page always redirects to google
please help me
PHP Session does not access session variable
Moderator: General Moderators
- daedalus__
- DevNet Resident
- Posts: 1925
- Joined: Thu Feb 09, 2006 4:52 pm
Re: PHP Session does not access session variable
check if session start failed on either page?
Re: PHP Session does not access session variable
session starts on the all pages successfully
- daedalus__
- DevNet Resident
- Posts: 1925
- Joined: Thu Feb 09, 2006 4:52 pm
Re: PHP Session does not access session variable
take out that redirect and get_defined_vars() or var_dump() or something.
what's the code on the other page look like? are you asking for the same variable on both pages? sometimes ill change the name of something and forget it is referenced in other files..
might you be using session_register() for some strange reason?
what's the code on the other page look like? are you asking for the same variable on both pages? sometimes ill change the name of something and forget it is referenced in other files..
might you be using session_register() for some strange reason?
Re: PHP Session does not access session variable
tried
var_dump($_session['memberId']);
it gives me
Undefined variable: _session
var_dump($_session['memberId']);
it gives me
Undefined variable: _session
Re: PHP Session does not access session variable
name of variable is same in both pages and am not using that register function
Re: PHP Session does not access session variable
and in the previous page the value of member id is 1.. i checked using var dump
-
phoenixrises
- Forum Newbie
- Posts: 8
- Joined: Sun Nov 15, 2009 8:24 am
Re: PHP Session does not access session variable
Use $_SESSION. Afaik, superglobals are case sensitive.