Page 1 of 1

session problem

Posted: Thu Aug 30, 2007 2:05 am
by shivam0101
I have the following link in main page where session is set

main page

Code: Select all

session_start();
$memberId=$_SESSION['member_id'];

echo "<a href='next_to_do.php')>session test</a>";// works
	
echo "<a href='javascript:void(0)' onClick=window.open('next_to_do.php')>session test</a>";// does not work
In the next_to_do page, i am not able to get memberId when i try to use popup

Re: session problem

Posted: Thu Aug 30, 2007 2:29 am
by Christopher
To set a session variable it is:

Code: Select all

session_start();
$_SESSION['member_id'] = $memberId;

Posted: Thu Aug 30, 2007 2:40 am
by shivam0101

Code: Select all

session_start(); 
$_SESSION['member_id'] = $memberId;
The above code i have written in login page.

The problem is when i use window.open, i am not able to retain the session values i.e member_id.
http://au2.php.net/function.session-start an example from, jorrizza at gmail dot com

how to solve without using querystring?

Posted: Thu Aug 30, 2007 8:10 am
by feyd
If the session cookie has been set, you won't need the query string. However, if it has not, you will.