How do I submit a form inside an iframe if the page that has the iframe is redirected?

4
  

I'm creating a page that works like this:

     

The person accesses a registration page, and within this page there is a iframe with the registration form. When a person clicks on iframe on sign up he redirects to another page I've created. But the new page appears inside iframe , and I want the page containing iframe to be redirected to sucesso.html .

I already tried to use something like target="" :

<form id="form1" target="_self" method="post" action="concluido.php">

But it continued the same way.

How to make the window redirect and not the iframe content?

    
asked by anonymous 27.05.2015 / 10:59

2 answers

2

If you want to open a new page, you can put an instruction on your page contained in the iframe so that when you finish receiving the PHP it makes a js call:

<script>
    window.open("suaPagina.php");
</script>

If you want to refresh the page by submitting the form you can do this:

<form action="login.php" method="post" target="_blank"></form>

Refacting here:  If you want the parent (parent page) to be fully updated, after the submit, you can do in php by adding a head after the post manipulation:

<?php    
    header('Localização: suaPagina.php');    
?>

You can do this by typing a js after the manipulation:

<script>
    window.location = "suaPagina.php";

</script>

Or you can use the form tag by submitting the entire screen:

<form action="login.php" method="post" target="_parent"></form>
    
27.05.2015 / 12:45
1

You can use target="_parent" if you have a link that should be clicked on the page containing the iFrame.

If you want to open a specific%% on the page containing the iFrame you can use url like this:

document.querySelector('a').addEventListener('click', function(e){
  e.preventDefault;
  window.parent-location = this.href;
});

Example online here

    
28.05.2015 / 15:37