# set $_SERVER['HTTP_REFERER'] to a different frame



## firestormer (Sep 16, 2005)

While trying to integrate two softwares i have had to use iframes. In one iframe there is a link that runs a php script then returns to the previous page.

The problem is because the link is in the iframe you are returned to just the page in the frame and then not the whole frame.

i am using the $_SERVER['HTTP_REFERER'] varable in the script to set the header location.

ie:

| -PAGE- |
| -PAGE- |
| IFRAME |

goes to

| IFRAME | WRONG

and not

| -PAGE- |
| -PAGE- | RIGHT
| IFRAME |

after the script is run.


----------



## haswalt (Nov 22, 2004)

if you mean you want to whole PAGE to change then you would have to intiate a change to the _parent, rather than just a change which will default to the current frame. I'm not sure you can do this with php since php cna't change things once they have bene loaded into the users browser. So the next best thing you can do is perhaps echo out some javascript with the php to change the parents address?

Hope that sheds, some light. I can give an example if it helps.

Harry


----------



## firestormer (Sep 16, 2005)

how do i do this?

The main page is html which i cant change to php. The page in the iframe is php.
The link in the iframe is like:
 Black

changing the target to _parent has no effect as http referer is is set as the frames page.


----------



## MMJ (Oct 15, 2006)

Its bad, bad practice to use HTTP_REFERER. Just pass the url you want to go back to with $_GET or cookie values.


----------



## firestormer (Sep 16, 2005)

The problem with passing the url using $_GET which is what ive tried to also do is that the url contains its own $_GET variables seperated by & which means when i call the get variable it dosnt call the whloe url but just the url up to the first &


----------



## MMJ (Oct 15, 2006)

It shouldn't, as long as you use $_SERVER['SCRIPT_NAME']

http://forums.techguy.org/6009310-post3.html


----------

