Page 1 of 1

session is not workin in next page

Posted: Tue Mar 25, 2003 9:27 am
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 ?
:?: