Jump to content

sessions from parent to pop-up


anujgarg

Recommended Posts

Stuck into a problem. Trying to pass session values from parent to popup window. But failed.

I am using the following:

 

session.php (parent window):

$value1=$_SESSION['name'];

echo "<a href=\"javascript:window.open('page.php?sid=<?php echo $value1;?>','name1','height=320,width=240');\">pop-up</a>";

 

page.php (popup window):

$a=session_id(strip_tags($_GET['sid']));

session_start();

echo $a;

 

Any thoughts?

Link to comment
https://forums.phpfreaks.com/topic/80227-sessions-from-parent-to-pop-up/
Share on other sites

session.php:

 

session_start();
echo "<a href=\"javascript:window.open('page.php?sid=".$_SESSION['name']."','name1','height=320,width=240');\">pop-up</a>";

 

page.php:

 

$a=session_id(strip_tags($_GET['sid']));
session_start();
echo $a;

 

should work for what you're doing.  Mainly you're sytax was wrong in session.php

Parent

-----------------------------

session_start();

$sesison_id = session_id();

echo "<a href=\"javascript:window.open('page.php?sid=".$sesison_id."','name1','height=320,width=240');\">pop-up</a>";

..................

..................

 

 

Child

-----------------------------------

session_id($_GET['sid']);

session_start();

.............

...............

 

 

 

 

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.