Search code examples
phpiframe

how to put text inside the input of a page that i opened with iframe?


I need to open a page from another site on my site and add text in the inputs of that page, so I used iframe to open it, but I don't know how to add the text in the inputs. Can someone help me?


Solution

  • The only way to achieve this would be if the page you're loading in the iframe allows GET parameters to be passed in with the URL. The form elements on the target site would then have to use the values as default for them to be displayed on load.

    E.g.:

    https://target.com/?formFieldOne=hello
    

    Then the code of the target page would have to be something similar to this:

    <input type="text" value="<?PHP echo($_GET['formFieldOne']); ?>" />