[thelist] any PHP session experts out there?

Tom Dell'Aringa pixelmech at yahoo.com
Wed Dec 11 16:19:01 CST 2002


I've been struggling with some PHP session tutorials, and I wondered
if I could get some tips. Most of the tutorials I find seem to be for
PHP3 not 4. The one I am using the guy says not to use superglobals
due to security. Anyway, I am doing this very simple code:

>From a simple form that has only a 'name' text field, I send it to a
process page that does this:

<?
// start the session
session_start();
header("Cache-control: private"); //IE 6 Fix

// Create a new Session Value
   session_register('name');

// Register the input with the value
   $_SESSION['name'] = $name;

   header("Location: products.php");
?>

I suppose $_SESSION['name'] = $name; could be $_SESSION['name'] =
$_POST['name']; as well, but I like using the globals myself.

Then I send them to a products page, where I want to display the name
from the session to see if it is working. I do:

// start the session
session_start();
header("Cache-control: private"); //IE 6 Fix

at the top of the page, then

Hey <? echo $_SESSION['name'];?>

in the page, and I get nothing but blanks.

I've perused the php.net docs and they are a bit scattered without
much practical stuff..any help is appreciated.

Tom


=====
var me = tom.pixelmech.webDeveloper();

http://www.pixelmech.com/
http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



More information about the thelist mailing list