You’re probably used to submitting forms to the same page or to a new window by setting the target of a form to ‘_self’ (or not setting a ‘target’ attribute) or ‘_blank’.
If you use iFrames however, be it as an interface element or a hidden element, there might be a time when you need to submit a form on an outer page and send the data to an iFrame used within the same page.
This can be easily acheived by using the ‘target’ attribute on the form I mentioned above and setting it to the name of the iFrame. Let me provide you with a very simple example of this below:
<html> <body> <form name="form1" action="iframe_page.php" target="myIframe" method="POST"> <!-- Form Elements Here --> </form> <iframe src="" name="myIframe></iframe> </body> </html>
In the example above, when our form is submitted, the data would be POST’ed to a file called iframe_page.php in the iFrame called ‘myIframe’.
Follow us on Twitter
Subscribe to RSS Feed
No comments have been left yet. Be the first