$_SESSION not working??? Please HELP!!!

From: garth15 (garth_r_jones_at_hotmail.com)
Date: 02/27/04


Date: 27 Feb 2004 09:12:41 -0800

I have two test files called index.php and index2.php.

Index.php:

<?php
session_start();
$_SESSION['sess_var'] = "hello world";

?>

<a href="index2.php">click</a>

-------------------------------------------------------------------------------
Index2.php:

<?php
error_reporting(E_ALL);
session_start();

echo $_SESSION['sess_var'];
?>

Index2.php does not display anything?!?! Any ideas??

I look at the session cookie and it has been set with the following
inside it:

sess_var|s:11:"hello world";

When I placed the line:

error_reporting(E_ALL);

in index2.php I got the following error:

Notice: Undefined index: sess_var in c:\program files\apache
group\apache\htdocs\index2.php on line 5

line 5 is:

echo $_SESSION['sess_var'];



Relevant Pages

  • Re: Object Oriented Content System - the idea
    ... >I expected php to be smarter then that. ... >form like bytecode in memory for the next request. ... each action added some stuff to a "response" XML document. ... that map/object/data and formats it for HTML display using an includeed PHP ...
    (comp.lang.php)
  • Re: session trouble
    ... Note that you're building your display block AFTER your loop. ... <?php session_start; ... The problem here is going to be since you have multiple school clubs, it's going to be hard to relate a particular club to the entry in your database if it going to be changed. ... Another way is to add a suffix to each field, often times the primary key for the table. ...
    (comp.lang.php)
  • Re: Redirecting between PHP Pages
    ... but at the very least in a php script. ... > on the outcome of the validation, you want to do one of two things: ... with the various bits of HTML being ... Display login form ...
    (comp.lang.php)
  • Re: Open and process remote page
    ... William Hudson wrote: ... I have toyed with some of the php functions for opening URLs, ... > I need to fully emulate a browser, ... > display the remote page). ...
    (comp.lang.php)
  • Re: Redirecting between PHP Pages
    ... Display login form ... >>other php files, you should never need a redirect your page except to ... pass it on to smarty which then displays it as html for me. ...
    (comp.lang.php)