Skip to content
Advertisement

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

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.

Advertisement

Answer

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">
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement