You are here: $_SESSION not working « All PHP « IT news, forums, messages
$_SESSION not working

Posted by flintridgeparkenfarker vonkerschnauzerheiden on 06/14/05 05:13

On local PC, WinXP, Apache 2, PHP 5, globals off, I'm simply trying to pass
1 value to get sessions working.
On the first page (end of HTML) I do show a value in $_SESSION['item'] right
after setting it:

FIRST PAGE:

<a href=secondpage.php>link</a>

</body>
</html>

<?
if (session_start()) {
echo "session started...";
$_SESSION['item']="necklace";
if (isset($_SESSION['item']))
echo "session item is SESSION = " . $_SESSION['item'];
else
echo "session item is not set";
}
else {
echo "no session started";
}
?>
------------------------------------------------------------------

BUT SHOW NO VALUE ON THE SECOND PAGE:

<?
if (session_start())
echo "session has begun...";
else
echo "no session.";

echo "<BR>";
echo "<BR>";
echo "going to end " . session_name() . " session; but first... <BR>";

if (isset($_SESSION['item']))
echo "Session[item] = " . $_SESSION['item'];
else
echo "session item is not set";
?>
------------------------------------------------------------

The output of the second page is:

"session has begun...

going to end PHPSESSID session; but first...
session item is not set

--------------------------------------------------------

Within the "session.save_path" are the files created by these statements and
the value "necklace" but I'm just not able to extract that value on any
other pages. I've tried placing the second page in a subdirectory per an
earlier post, no good. It seems like it's a configuration issue, but I'm
unable to find anything that relates.

I'd wager it's something simple, but it's been a couple weeks and I can't
find it yet. Any help would definitely be appreciated.

Thanks all.

--
joe
/*------- A new survey of online daters found that
47% of people believe that their online date will
go well... the other 53% are still missing. -------*/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация