FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Automatically submitting a form.

 


PatTheGreat42
Is there any way that I could create a page that automatically sends a form as soon as a webpage is loaded?

I'm thinking JavaScript and an onLoad tag could be used, but I really have no idea. Any ideas are welcome. Thanks.
Nyizsa
You may simply redirect the browser.
Code:
<body onload="javascript:window.open('form.php?item1=value1&item2=value2...','_self')">

Then you can access the information via $_GET['item1'] and so on.
If you collect the data you want to send (browser type? remote address? whatever.), you may concatenate a string using that info. Then you may be better off with a function.
Good luck!
kv
If you have a form, say for ex, by name "myform", then you can use

Code:

<body onload="javascript:myform.submit()">


which submits "myform" after loading the page.
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.