How do I set a value in an input tag from another site?

1

How could I do to pass a value to a <input> field from another site?

In practice, I would like that when the user clicks on a link, button, and so on. (eg www.google.com) and in a given field a value that I have on my site appears.

So it would only take the user to submit the form on that other site.

I use PHP, JavaScript and JQuery technologies.

    
asked by anonymous 03.04.2015 / 04:02

4 answers

2

As I said, if the other site is not yours, it's complicated, but some sites offer this in a simple way, through the url ....

04.04.2015 / 04:08
1

Fields of a form are usually pre-filled with the value="" attribute. By simply calling another website, there is no way for you to modify this attribute for any given.

Sometimes , as @MatheusCristian mentioned, the site is made that can pass some value through the URL, and there that site places that value within the value attribute.

So, you are at the mercy of implementing the other site, and have nothing guaranteed.

    
24.08.2015 / 20:09
0

run a javascript script to fill in what you want, but however, the script will run and fill only the browser where the script runs, ie if you want to do this to "oblige" a schedule to the site will not scroll, but if you want to write a "layer" of javascript after the browser page open then yes it is possible, just open the console, paste the script and run it.

    
24.08.2015 / 21:44
0

You can use the example GET method:

$x = $_GET['id'] ? $_GET['id'] : NULL;

and no html:

<input type="text" value="<?= $x ?>"/>

on site1 you can do to redirect to the site2 example:

<?php header('Location: www.site2.com/index.php?id='. $id); ?>

and the value of x will be the value of $ id

    
31.03.2017 / 17:17