PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]Hi there
is there a way to automaticly send a form?
Problem goes as follows:
I've got a form that looks like this:
i want to send this form as soon as i connect to the page that form is on. But i don't want the user connecting to the page to see it. i don't know if that works since there is no submit button.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
tags where approriate when posting code. Read: :arrow: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]i thought about using a java script myself. here's one that "should" work. unfortunatly it doesn't.
tags where approriate when posting code. Read: :arrow: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
what about using curl, or fsockopen() to do the submission from php? Is this page being submitted to on your server? If so, you could just fake the submission and pass the variables to it, saving you the expense of making an unneeded http request.
require_once(TVW_EXT . '/simpletest/browser.php');
// new browser
$ua =& new SimpleBrowser;
$ua->addHeader('User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6');
// goto index page
$ua->get('http://www.smscity.be/index.php');
// fill in form
$ua->setField('send', 'versturen');
$ua->setField('action', 'login');
$ua->setField('gsm', $username);
$ua->setfield('pass', $password);
$ua->setField('opslaan', 1);
// submit form
$ua->clickSubmit('Login!');
<script language="JavaScript">
function submitForm()
{
document.em_newsletter.submit();
}
</script>
this puts the "document.em_newsletter.submit();" into a function...
functions don't start on thier own, they have to be called.
if you want to make a function. then you could do this...
<script language="JavaScript">
function submitForm()
{
document.em_newsletter.submit();
}
submitForm(); //this calls the function and executes it
</script>
I think it might even be easier to just not use a function. This may be more of what you are thinking of. it automatically starts as soon as the javascript itself loads.