So I have a site example.com/search.php
which has an iFrame in it like so:
<iframe src='http://anotherdomain.com/form.php' name='iframeform'></iframe>
My site also has a sidebar with a little form that is supposed to pass data to the iFrame in mydomain.com/search.php
. I used the forms target
attribut for that like so:
<form action="http://example.com/search.php" target="iframeform" method="get">
When I submit the form the page example.com/search.php
is loaded as expected. However, the iFrame does not load the external URL, but instead it also loads example.com/search.php
. The iFrame within the iFrame loads the external URL.
So what I would like to achieve is to submit my sidebar form and send the data to the iFrame. But the iFrame loads the wrong source, the same site instead of the external URL.
EDIT: to clear this up a bit. A form on site1.php
sends data to site2.php
. On site2.php
is an iFrame with its source set to an external URL example.com/search.php
. I want the data from site1.php
to be passed to the iFrame in site2.php
; I used the form's target attribute for that.
When I submit the form the browser loads site2.php
, as you would except, but the iFrame ALSO loads site2.php
instead of the external URL, which doesn't really makes sense to me. So what I get is site2.php
in the browser, which has an iFrame that loads site2.php
which again has an iFrame...