Return to Snippet

Revision: 72208
at June 5, 2017 05:05 by apphp-snippets


Initial Code
<form action="iframe.php" target="my_iframe" method="post">
   <label for="text">Name:</label>
   <input type="text" name="full_name">
   <label for="text">Email:</label>
   <input type="text" name="email">
   <input type="submit" value="post">
</form>
<iframe name="my_iframe" src="iframe.php"></iframe>

Initial URL
www.apphp.com/index.php?snippet=html-post-data-into-iframe

Initial Description
To send data into iFrame you don't need JavaScript or anything. You just have the form's target attribute match the iframe's name attribute. The outer page doesn't even reload. Copy this code and test it.

Initial Title
Post Data to iFrame with HTML Only

Initial Tags
html, post

Initial Language
HTML