On Saturday 14 December 2002 17:19, John Taylor-Johnston wrote:
> I did call session_start() before anything is output to the browser.
> http://www.php.net/manual/en/function.session-start.php
>
> I only have one php file so I know I'm recyling my code each time:
>
> session_name("TestALS");
> session_start();
>
> session_register("studentid");
> if (isset($_SESSION["studentid"]))
> {
> $id = $_SESSION["studentid"];
> echo "\$studentid= $studentid<br>";
> }

RTFM again. Sessions depends on a number of factors including your version of 
PHP and the setting of register_globals.

Basically if you're going to be using $_SESSION then you don't use 
session_register(). You just assign the value directly to $_SESSION.

<?php // test-session.php

  session_start();
  
  if (!isset($_SESSION['studentid'])) { $_SESSION['studentid'] = 24; }
  if (isset($_SESSION['studentid']))
  {
  $_SESSION['studentid']++;
  $id = $_SESSION['studentid'];
  echo "\$id= $id<br>";
  }
   
?> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to