[thelist] Get Referrer URL in Frames w/PHP

Razzak Jallow razzak at mac.com
Mon Jun 16 16:57:28 CDT 2003


Hey, I'm trying to figure out how to do this and I'm pretty new, so 
here goes.  A person clicks a link from my site that has 
foo.com/frame.php?url=foo2.com.  the frame.php loads foo2.com in the 
bottom  frame and the top frame I want to have a link back to the page 
they came from on my site.  The problem is I can't figure out how to 
get that to happen.  Inside the top frame, the getenv(HTTP-refer) is 
always empty.  I don't really know what I'm doing with the globals 
either.  Tried the php man but it's not nearly as good as the mysql man 
(IMO, probably since php is more of a programming language its more 
complicated.. im not a programmer).

Any help would be greatly appreciated.
Link Example:
<a href="/frame.php?url=http://www.foo2.com" target="_top">


Frame Set Code:
		<frameset rows="19,*">
		<frame name="top" noresize scrolling="no" src="/frametop.php">
		<?php
			global $savepage;
			$GLOBALS["$savepage"] = $_SERVER['HTTP_REFERER'];
			print '<frame name="main" noresize src="'.$url.'">';
		?>


Top Frame Code:
	<?php
				print '<a href="';
				
				if (!empty($GLOBALS["$savepage"]))
				{
				print $GLOBALS["$savepage"];
				}
				
				else
				{
				print 'http://www.myfoo.com/';
				}
				
				print '" class="leftbar" target="_top">Back to the MyFoo!</a>';
				
				?>

Thanks for reading this.

--
Razzak Jallow



More information about the thelist mailing list