By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,278 Members | 1,359 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,278 IT Pros & Developers. It's quick & easy.

How can I get session variable names

P: n/a
Hello Everybody

I have a big problem. Please guide me.

Is there any way through which I can get what session variables are
created in the session.

Suppose there are two pages. Page A and page B

Page A has a link for page B

When a person clicks link of Page B on Page A, he should get the list
of all session variables and there values.

Is this possible?

Also is it necessary that Page A should also be in php. Will it work
if it is java.

Divyendu

May 6 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
gu************@gmail.com wrote:
Hello Everybody

I have a big problem. Please guide me.

Is there any way through which I can get what session variables are
created in the session.

Suppose there are two pages. Page A and page B

Page A has a link for page B

When a person clicks link of Page B on Page A, he should get the list
of all session variables and there values.

Is this possible?

Also is it necessary that Page A should also be in php. Will it work
if it is java.

Divyendu

From php:

<?php session_start(); ?>
....

<html>

<pre>
<?print_r($_SESSION);?>
</pre>

Of course you can neaten it up by enumerating your $_SESSION array, i.e.
with foreach().

To do it in Java, try a java newsgroup.

And if you're talking about sharing session values in PHP and Java, I
don't think you can do it with the default handlers. But I haven't
tried, either.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 6 '07 #2

P: n/a
Is there any way through which I can get what session variables are
created in the session.

Suppose there are two pages. Page A and page B

Page A has a link for page B

When a person clicks link of Page B on Page A, he should get the list
of all session variables and there values.
Yes, just show the contents of $_SESSION. With a foreach-loop can build
you nicely formatted results.
Also is it necessary that Page A should also be in php. Will it work
if it is java.

In short: page A should be in PHP.

This is not a really absolute statement, however. PHP knows a "session
handler" which can be configured. You could theoretically write a
session handler that can read the java session, but you will have to do
some research on how to do it...
If you go that way, it may even be easier to use plain file handling (or
whatever mechanism java is using) and read java's session file. I do not
know how java stores session values.

Best regards.
May 6 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.