This is a simple function in PHP to insert a JavaScript sentence which will do the same action as if the user would be pressing the Submit Button.
It can be used to use any control as a Submit Button or in case you make a form you need to send without interaction from the user.
the $FormName must be the name specified in the Form tag (i.e.: <form action="MyActionURL" method="post" enctype="application/x-www-form-urlencoded" name="MyFormName">), if you didn´t specified any, you must now :)
Lastly, just a tip regarding a trouble I had and may be you case too... if you have a form with all hidden fields, it won´t work, you have to have at least something echoed inside the form, just a letter can help, anyway, as it will redirect to the action URL, it should not be a problem as the form will disappear.
function SubmitForm($FormName) //JavaScript function to submit a form programmatically //$FormName must be form´s name (as specified in the opening form tag) { echo '<script language="javascript">document.'.$FormName.'.submit()</script>'; }