Session with php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tiendan
Forum Newbie
Posts: 9
Joined: Tue Apr 01, 2003 11:39 pm
Location: Vn

Session with php

Post 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
User avatar
oQEDo
Forum Commoner
Posts: 43
Joined: Thu Feb 20, 2003 11:08 am
Location: UK

Shhhh!

Post 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
JPlush76
Forum Regular
Posts: 819
Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:

Post by JPlush76 »

echo $_SESSION['name'];
Post Reply