at aa.php webpage, i open a webpage called bb.php as _blank. then, when i do some stuff in bb.php, i want to send the variable and go back to the aaa.php and auto close the bb.php. but when i test to run the page, it can open the bb.php (at new window), but it cannot go back to the aa.php at same window. how to make it go back to the same window and auto close the bb.php window? plz help... thanks!
You can use the $_SESSION variable to store the variable data. This will be accessible from both windows if you use session_start() at the beginning of both scripts. You could use javascript to force the bb.php window to close after certain task is completed.
ok , i understand what you said. but one more problem is.... - broswer A open aa.php. - then, aa.php open bb.php at new window (let said is broswer B) - den when i go back to aa.php from bb.php, the aa.php appear at broswer B, not broswer A.
If I understand you correctly, you want a script to run in aa.php after bb.php has closed? If so, you'll need to tinker around with javascipts onfocus event. Unless you absolutely must take this approach, I'd recommend exploring alternative solutions to whatever reason your doing this. I'm not a javascript expert (I avoid at all costs) so I can't tell you exactly what code you'll need to accomplish this.
oppp...heard like complicated... i need to change to other way... coz i 'm not a javascript expert too..
Let me know why you are taking this approach, and I might be able to suggest another way to get the job done.
if this is your problem: 1. page1.php will give one more pop up page page2.php 2. Once after page2.php closed you have to return some variables to page1.php solution : function refreshopen() { window.close(); window.opener.location=window.opener.location+"?a1=test"; window.opener.location.reload(); } put all your variables you gathered in page2.php as querystrings and call this refreshopen function on unload of the page now, once after you close this child window, your parent page will be reloaded with the querystrings attached, consider this when you are sure that you are not passing any secure information
Page 1 <?php $return_val = $_GET["a1"]; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <p><a href="page2.php" target="_blank">Open page 2</a></p> <p><?php echo "a1 value: ".$return_val; ?></p> </body> </html> Code (markup): Page 2 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <SCRIPT LANGUAGE="Javascript"> function refreshopen() { window.close(); window.opener.location=window.opener.location+"?a1=test"; window.opener.location.reload(); } </SCRIPT> </head> <body onUnload="refreshopen();"> <a href="page1.php" target="_parent">Go back to page 1</a> </body> </html> Code (markup): I admit that i don't know to use javascript... now i 'm able to open page 2 and return to page 1 as what i want. but... did i get the return value in wrong way? i cannot display return value at page1.