Session and link

This is a discussion on Session and link within the PHP Language forums, part of the PHP Programming Forums category; I've to create link to a new page using session variables. I've about 20 variables already set, so ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-20-2004
Bob Bedford
 
Posts: n/a
Default Session and link

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.

www.mysite.com/detail.php?ID=2
www.mysite.com/detail.php?ID=4
www.mysite.com/detail.php?ID=5
www.mysite.com/detail.php?ID=7
www.mysite.com/detail.php?ID=54
....

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....

Bob


Reply With Quote
  #2 (permalink)  
Old 10-21-2004
Zurab Davitiani
 
Posts: n/a
Default Re: Session and link

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
clicked;
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
http://bogussite.com/1234/
where 1234 is the ID, and then use Apache's mod_rewrite (or a similar tool
for other web servers) to translate to
http://bogussite.com/details.php?ID=1234
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.
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:10 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0