Re: passing variables from - to frames

From: Date: Wed, 27 Jun 2001 06:48:31 +0000
Subject: Re: passing variables from - to frames
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-55331@lists.php.net to get a copy of this message
framea and frameb don't know about each other, but their document and their window should know both of them. So, you can use document.framea... and document.frameb... to access each other's variables. Also, if these variables are coming from PHP, and if you are using FRAMEs mostly for looks, and not so much to save downloading one of the frames all the time, another alternative, avoiding JavaScript, which you can never trust to be on, much less to work properly when it is on, is to actually send all your links back to the main frameset page, and pass the variables down in parallel: ---- main.php ---- <?php $foo = isset($foo) ? $foo : ''; ?> <HTML> <FRAMESET> <FRAME SRC=framea.php?foo=<?php echo urlencode($foo);?>> <FRAME SRC=frameb.php?foo=<?php echo urlencode($foo);?>> </FRAMESET> </HTML> ---- framea.php <HTML><BODY> <?php echo "foo is $foo<BR>\n"; ?> <A HREF=main.php?foo=bar TARGET="_top">bar</A> <A HREF=main.php?foo=different TARGET="_top">different</A> </BODY></HTML> ---- frameb.php <HTML><BODY> <?php echo "foo is $foo<BR>\n"; ?> -- WARNING richard@zend.com address is an endangered species -- Use ceo@l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm

« previous php.general (#55331) next »