Jump to content

[SOLVED] Session blank at page 2


cltn77

Recommended Posts

I want to retrieve session at new window after i click a link from the main window.

 

Test2.php is main page

Test.php is new page

 

Test2.php

<?php

session_start();
$_SESSION['usercd']='usercd';
?>
<html>
<body>
<A class=medium href="test.php" target="_blank">Test</A>
</body>

<?php
   echo "<pre>";
   print_r($_SESSION);
   echo "</pre>";
?>
</html>

 

 

test.php

<?php
   session_start();
   echo "<pre>";
   print_r($_SESSION);
   echo "</pre>";
?>

 

Can any one help me?

TQ

 

Link to comment
https://forums.phpfreaks.com/topic/160754-solved-session-blank-at-page-2/
Share on other sites

print_r($_SESSION); on the main page does not actually mean that sessions are working at all. It just means that there is a variable being set on the main page called $_SESSION['usercd'] and you can display it on that page.

 

For debugging purposes, add the following two lines of code immediately after your first opening <?php tag on both pages -

 

ini_set("display_errors", "1");
error_reporting(E_ALL);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.