Session Cookie inconsistency

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 32
Joined: Tue Feb 04, 2003 10:32 am
Location: UK

Wed Mar 19, 2003 10:33 am


I have a question more than a problem.

I've got a login system that is (where user cookies are switched off) passing the PHPSESSID around to track user movements.

This behavior appears inconsistent under different circumstances. Here's a few examples.

if the URL is hard-coded as in this example it will append the PHPSESSID okay.

<a href="home.php">

But not if it's this:

<a href="">

Also, not if it's this:


<a href="<?echo"$url";?>/home.php">

If I make a form like so:

<Form name="foo" Action="home.php">

it will work, but it puts the PHPSESSID in a hidden field within the form.


<Form name="foo" Action="<?echo"$url";?>/home.php">

does the same.

If I do


<Form name="foo" Action="<?echo"$url/$page";?>">

it displays no PHPSESSID at all.

Lastly, the site has a Content Management System within it which displays URL's and if I push the following out of the CMS:

<a href="home.php">

it works, but not:

<a href="">

Can anyone lead me to the rules with regards to this?

Thanks guys and gals,

A learned man is an idler who kills time by study.

George Bernard Shaw (1856-1950)

User avatar
Posts: 826
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Fri Mar 21, 2003 10:12 am

Why are cookies turned off. You should make note that there are talks of deprecating the function to track sessions through URL.

may sound stupid but are you sure you have session_start() at the top of each page.

another thing is you can manually add the session id to the URL by adding &PHPSESSID=<?php session_id();?>

Post Reply