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

Session and link

P: n/a
I've to create link to a new page using session variables.

I've about 20 variables already set, so this is OK. But now I've 50 links to
various articles on my page. Those links are created dynamically using a
mysql table, so I take the ArticleID.

I'd like to avoid passing the ID in the URL. It's there any way to pass it
in the SESSION variable. Javascript isn't possible, so I'd like to know if
it's the only way to create the link. Or maybe must I use a FORM for every
artivle ???? but with a link, I must use javascript....

Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Bob Bedford wrote:
I'd like to avoid passing the ID in the URL. It's there any way to pass it
in the SESSION variable.

To be able to store a value in the SESSION array, it has to be passed
somehow from the browser to the server. Otherwise, you will not know what
link the user clicked. There are 2 ways to do this - with HTTP get and post
requests. So yes, you can store that variable in the session array, but it
has to be passed to the server do so.

Now, I don't know what your issue is:
1. you don't want to send that particular ID parameter; or
2. you don't want to send any parameters; or
3. you don't want to display any parameters in the browser location bar

So, some ideas, respectively (if you don't want to use post or javascript):
1. Then send something else - title, some other temporary session-based
reference, etc.
2. You can't not send anything because then you will not know what the user
3a. What you can do is send the ID to article-redirect.php that will set a
session variable and then redirect to details.php. details.php will read
that session variable and display the article without displaying the ID in
the browser location bar.
3b. You can also send the article ID in the URL itself
where 1234 is the ID, and then use Apache's mod_rewrite (or a similar tool
for other web servers) to translate to
So, the browser will see only the original URL, while the content will come
from details.php.

Anyway, I don't understand what you are trying to accomplish with this. You
have to remember that (except in 3b) it will be harder for your users to
bookmark your articles, send links to friends, etc.
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.