Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Submit PHP form in iFrame, and go to _parent

Explorer ,
Nov 22, 2011 Nov 22, 2011

Hi,

So I have a PHP form that is quite long. It is rendered in an iFrame in another html page (for css reason).

I have set the dimensions of the iFrame to be as long as the form itself, as I believe that have a scroll bar that goes down "the middle of the page" (as it were - i.e. down the side of the iFrame) as well as down the edge of the page (the actualy parent page) is confusing for the user, and ugly.

However, by the time the user gets to the bottom of the form, they are quite a long way down the "_parent" page. So, when they click 'Submit', and the $insertGoTo = "/thanku.html" executes, they don't actually see the Thank You page, because it renders in the iFrame that they're at the very bottom of. The only way they see it is if they then choose to scroll up to the top of the page.

Is there any way of getting the parent page to default back to the top at this point?

Failing that, is there anyway of getting the $insertGoTo command to GoTo the parent page instead of the iFrame?

Thank you.

TOPICS
Server side applications
2.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Jan 24, 2012 Jan 24, 2012

I got it: I put this at the top of my thanku.php page:

<script language="JavaSCript">

if (top.location != location) top.location.href = location.href;

</script>

This breaks the page out of the frame.

Translate
Explorer ,
Nov 24, 2011 Nov 24, 2011

Might make this easier to answer if you can see the page in question:

http://www.whataretheyreallylike.com/review.html

Your thoughts, please?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 26, 2011 Nov 26, 2011

Wouldn't it be simpler to work on the "css reason" for the form being in a IFrame so that you could integrate the IFrame page's code into the parent page?

What is that reason?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 24, 2012 Jan 24, 2012
LATEST

I got it: I put this at the top of my thanku.php page:

<script language="JavaSCript">

if (top.location != location) top.location.href = location.href;

</script>

This breaks the page out of the frame.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines