views:

19

answers:

1

Sorry if this is a newbie question, but I've spent several hours on this without success. I've got a PHP script that generates some text I want to submit to an external Web site's form. Is it possible to use JavaScript code on one page to open a page on another server and then add text to that second page's html form from the code on the first page?

A: 

No. Check out this wikipedia article about same origin policy: http://en.wikipedia.org/wiki/Same_origin_policy

EDIT: One thing you can do is submit form data from one site to another. So for example if there is a sign in form on a page. You can't use javascript to populate that form but you could use your page to do a form post from your site to the action of the form on their site. Just make sure that the method(get,post) is the same and the field names are the same. Though keep in mind that a lot of sites do check to make sure that forms are submitted from their own sites but it is possible to try something like this.

spinon