Auto submit form outside of frame

Hi i have a form inside a frame, for example:

<html>
<body>
<div><h1>Header</h1><hr /></div>
<iframe height="75%" width="75%" src="iframe.php" frameborder="0">
Iframe should be enabled.
</iframe>
<div><hr /><h1>Footer</h1></div>
</body></html>

in iframe.php

<form action="http://some-url" id="my_form" name="my_form" method="POST">
<!-- hidden fields goes here --->
<input id="<?php echo $key; ?>" name="<?php echo $key; ?>" value="<?php echo $value; ?>" type="hidden"/>
<!-- //hidden fields goes here --->
</form>
<script type="text/javascript">document.getElementById("my_form").submit();</script>

I would like to know how to submit the iframe.php form so that it goes out of frame.
I think we need to tweak this code:

<script type="text/javascript">document.getElementById("my_form").submit();</script>

Thanks in advance.

what do you mean by

When the form is submitted, all the form data goes to the value of the action attribute

How can you Earn money online?

What i want is:
When the form inside the frame is submitted then it should no longer be inside the frame, that’s all.
Thanks

Then you need to specify exactly where you want it to be relocated to.

<html>
<body>
<div><h1>Header</h1><hr /></div>
<iframe height=“75%” width=“75%” src=“iframe.php” frameborder=“0”>
Iframe should be enabled.
<form action=“http://some-url” id=“my_form” name=“my_form” method=“POST”>
</iframe>
<div><hr /><h1>Footer</h1></div>
</body></html>

if i make the action of the form to say:
action=“http://my-domain.com/api

then this page will be inside the frame of the parent.

hope you got my point.

Thanks

FYI, this is not the proper way of using iframe.
Thanks

I know.

But you still haven’t said where you want the form to go to outside of the frame after the form has been submitted.

If you don’t want it in the frame, where do you want to put it as per your question

What i want is:
When the form inside the frame is submitted then it should no longer be inside the frame, that’s all.
Thanks

I don’t think you are getting my point.
Wherever i want to go… just want to get out of frame.

Thanks

Hey i found the solution:
use target=“_parent” in form.

  1. target is deprecated in <form>

  2. adding target to the form is not taking the form out of the frame at all as you asked but simply outputting the result of the processed form data in a new window.

it appears you didn’t understand what you were asking because the form will still be in the frame but the output will be in whatever target is set to.

It’s working now.
Thanks a lot for you effort.