session is not workin in next page

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
satish
Forum Newbie
Posts: 1
Joined: Tue Mar 25, 2003 9:27 am
Contact:

session is not workin in next page

Post by satish »

Hello
I am not able to view the session pages on my server but its working fine on my local server.My local server has PHP Version 4.3.0 and my server has PHP Version 4.2.2 .
this is the simple code to set session page1.php

Code: Select all

<?php
session_start(); 
header("Cache-control: private");  
if ( !isset($_SESSION['username']) ) { 
   $_SESSION['username'] = 'jason'; 
} 

echo '$_SESSION[username] equals '.$_SESSION['username']; 
echo '<br><br><a href="session2.php">Go to page 2</a>'; 

?>
and the session2.php content



Code: Select all

<?php

session_start(); 
header("Cache-control: private");  
echo '$_SESSION[username] equals '.$_SESSION['username']; 
echo '<br><br><a href="page3.php">Go to page 3</a>'; 



?>
So when i view page1.php on my local server and click on the link in the next page it shows the session value.
But when i upload it on my server it does not shows the session value.

any answer ?
:?:
Post Reply