-1

I have a simple php page that set the session and redirect to another page but for some reason the session is empty in the second page.

index.php

<?php session_start(); ?>
<?php 
 $_SESSION['name'] = "Saeed";
 echo $_SESSION['name'] ;  <<< it shows the correct output
 echo '<script type="text/javascript">window.top.location="otherpages/page.php";</script>';
?>

page.php

<?php session_start(); ?>
<?php
           echo "session>>>".$_SESSION['name'];  
        ?>
Saeed Pirdost
  • 167
  • 3
  • 12

1 Answers1

1

Verify if your tmp folder or session.save_path in php.ini is writable

Ps.: must works in both case. calling another page with php header or with javascript location

Heberfa
  • 441
  • 3
  • 8