PHP "header (location)" inside IFRAME, to load in _top location?

Spoonk picture Spoonk · Jun 6, 2010 · Viewed 79.1k times · Source

I have a simple form which is inside IFRAME. When user click on SUBMIT, it redirects to a specific page on my server. The function I use for the redirect is

 header ('Location: mypage2.html');
exit ();

But I want the new page to open in _top location, not inside the same IFRAME that I use. How can I tell the browser to open the new page in _top not inside the IFRAME? Thanks in advance.

Answer

Michal M picture Michal M · Jun 6, 2010

You are not able to achieve the desired effect in PHP. This is something you'd have to do from JavaScript or add target attribute to <form>:

<form ... target="_top">