Page 1 of 1

Session with php

Posted: Fri May 23, 2003 4:28 pm
by tiendan
I have some question about session in PHP

I have a file session.php below

Code: Select all

<?
  session_start();
  
  $name='ABC';
  
  session_register('name');

?>
and file view.php

Code: Select all

<?
    session_start();
    echo $name;
?>
mod_edit: added php tags


I think my code is no problem . The result is ABC on the screen, but when i used session_name('name') , a PHPSESSID is output on the screen, is it a problem. And I don't know a scope of $name, it is a Global variable ?

Please help me

Thanks

Shhhh!

Posted: Fri May 23, 2003 5:41 pm
by oQEDo
Have you read the sticky post viewtopic.php?t=6521 and the bit in the PHP manual about sessions?
The moderators will get pretty annoyed if you havent! :x

Posted: Fri May 23, 2003 6:13 pm
by JPlush76
echo $_SESSION['name'];