At 9:25 AM +0000 11/8/01, Russ Michell wrote:
>1: Rid any whitespace between '<?php' and 'session_start()'
>2: You need to populate the variable you wish to use as a session 
>variable before registering it

Is 2 actually true?  The sessions chapter in the PHP manual doesn't seem
to specify any order for using and registering, and in fact gives examples
to the contrary (see examples 2 and 3 in the chapter).

>
><?php
>session_start();
>if(!isset($UserName)){
>$UserName = "guest";
>session_register('"UserName');
>}
>
>//----rest of script goes here
>?>
>
>HTH
>Russ
>
>On Wed, 7 Nov 2001 20:02:03 -0500 Matthew Tedder <[EMAIL PROTECTED]> wrote:
>
>>
>>  Can anyone tell me why my session isn't working?  I have attached 
>>the problem
>>  script.  Without even going to another page, the $PHPSESSID and $UserName
>>  variables are both empty.  They are also empty on subsequent pages. 
>>
>>  It starts with:
>>  =========================================================
>>  <?php
>>
>>  session_start();
>>  session_register("UserName");
>>
>>  /*=====<< Check for New User Session >>=====*/
>>  if(!isset($UserName))
>>  {
>>    $UserName = "guest";
>>  };
>>  ==========================================================
>>
>>  And toward the end, it has the following:
>>  ==========================================================
>>  function ShowMessage($message)
>>  {
>>    print "<br>\n";
>>    print "<table border=2 align=center>\n";
>>    print "<tr><td align=center><font color=yellow>$UserName ($PHPSESSID):
>>  $message</font></td></tr>\n";
>>    print "</table>\n";
>>  }
>>
>>  ?>
>>  ==========================================================
>>
>>  In this function, the variables are flat empty.
>  >
>  > --Matthew
>>
>
>#-------------------------------------------------------#
>
>   "Believe nothing - consider everything"
>
>   Russ Michell
>   Anglia Polytechnic University Webteam
>   Room 1C 'The Eastings' East Road, Cambridge
>
>   e: [EMAIL PROTECTED]
>   w: www.apu.ac.uk/webteam
>
>   www.theruss.com
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to