Forum Moderators: coopster

Message Too Old, No Replies

Can PHP tell me its window name?

It would be a great way to pass data!

         

ewordsmith

10:37 am on Jun 3, 2005 (gmt 0)

10+ Year Member



I'm not keen on cookies since not everyone accepts them. So I would like to pass information via a window name. I know JavaScript could do this by extracting the containing window name, but can PHP do this as well? It's so darned clever, I can't believe JavaScript has the edge here. If it could, I could use this trick to pass information that would endure beyond subsequent window content not controlled by me and pick it up later. That is the aim: to simply name a new window as the data string later required. I imagine only JavaScript can be used for this trick, but does anyone know better? I am only a PHP hack, so please excuse ignorance. It would be nice and clean to avoid JavaScipt if that is possible.

dcrombie

11:50 am on Jun 3, 2005 (gmt 0)



The difference between PHP and JavaScript is that PHP code never makes it to the web browser.

Blackie

11:51 am on Jun 3, 2005 (gmt 0)

10+ Year Member



Sorry, php is to no help in this case. JS rules here.

ewordsmith

12:45 pm on Jun 3, 2005 (gmt 0)

10+ Year Member



Of course!
See, I said I was a hack.
Thanks for reminding me of the obvious.

mcibor

12:57 pm on Jun 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can always pass the variables in url, however it's not user friendly. There's also post and session

in url:
<a href="index.php?a=my%20variable">
$a = $_GET["a"];//a = "my variable";

in post:
<form method="POST" action="index.php">
<input type="text" name="a" value="my variable">
$a = $_POST["a"];//a = "my variable";

in session:
session_start()
$_SESSION["a"] = "my variable";
$a = $_SESSION["a"];//a = "my variable";

Hope this helps you to choose between methods. BTW passing the vars with window name and url is sometimes annoying to the user (it's not visually friendly)
Best regards
Michal Cibor