1

I have a html form with post method something like this :

<form action="xml.php" method="post">
    <textarea rows="15" cols="30" name="user"></textarea>
    <input type="submit" value="Export to xml">
</form>

When user presses the submit button page redirects to xml.php and xml.php's contents changes by user input. (POSTing method)

I want to use an iframe tag for xml.php But I don't know how ? because it redirects to the xml.php how can we iframe result of xml.php in current page ? (showing the result of xml.php in current page)

razer
  • 17
  • 3

1 Answers1

1

You can make an ajax post to xml.php and then print the the returned result.

eg: http://api.jquery.com/jquery.ajax/

If you want to use iframe then

<form action="xml.php" method="post" target="my_iframe">
    <textarea rows="15" cols="30" name="user"></textarea>
    <input type="submit" value="Export to xml">
</form>

<iframe name="my_iframe" src="xml.php"></iframe>

Pay attention that the content of iframe is loaded when the page load so maybe you want to hide the iframe and then show after the post.

Similar question: How do you post to an iframe?

Community
  • 1
  • 1
Thesee
  • 161
  • 4