Post Data to iFrame with HTML Only

/ Published in: HTML
Save to your folder(s)

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.

Copy this code and paste it in your HTML
  1. <form action="iframe.php" target="my_iframe" method="post">
  2. <label for="text">Name:</label>
  3. <input type="text" name="full_name">
  4. <label for="text">Email:</label>
  5. <input type="text" name="email">
  6. <input type="submit" value="post">
  7. </form>
  8. <iframe name="my_iframe" src="iframe.php"></iframe>


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.