/    Sign up×
Community /Pin to ProfileBookmark

auto submit form outside of frame

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

[code=php]<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>[/code]

in iframe.php

[code=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>[/code]

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:

[code=php]<script type=”text/javascript”>document.getElementById(“my_form”).submit();</script>[/code]

Thanks in advance.

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @PHPycho spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...