title: Form submit in $(document).ready(function(){. Is there a simple fix?
body: <p>This should be an easy fix for the right guru!  Everything is working for me except that I can't get this form to submit without clicking the submit button. The data values are all valid.  The action page, ...gdform.php, uses $_post to get the "redirect" value from the form and then uses php to do a  header Location change.  That works fine if I execute the form with the submit button. I just need it to happen without any click...<br>
  Take a look, please!</p>
  
  <pre><code>&lt;?php session_start();
  require_once('Connect.php') ;
  ?&gt;
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;&lt;title&gt;Nitrofill Document&lt;/title&gt;
  
  &lt;?php
  //error_reporting(E_ALL);
  $sn=$_GET['num'];
  echo $sn;
  
  mysql_connect($hostname,$username, $password) OR die('Unable to connect to database! Please try again later.');
  mysql_select_db($dbname);
   $selectSQL = "select * from `Presentations` where `serialnum` ='" . $sn ."'" ;
  
  $result = mysql_query($selectSQL) or die(mysql_error());
  $row = mysql_fetch_array($result,  MYSQL_BOTH);
  $thedoc = urldecode($row['docurl']);
  $therecip=urldecode($row['recipient']);
  $thetracker=urldecode($row['tracker']);
  $lastacc=urldecode($row['last_accessed']);
  
  ?&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;form id="notice" action="http://m3sglobal.com/gdform.php" method="post"&gt; 
  &lt;input  name="subject" value="&lt;?php echo $therecip . " has viewed the document you sent them.";?&gt; " /&gt; 
  &lt;input type="hidden" name="redirect" value="&lt;?php echo $thedoc ; ?&gt;"/&gt;
  &lt;label&gt;Email:&lt;/label&gt;&lt;input type="text" name="email" value="&lt;?php echo $thetracker ; ?&gt;"/&gt;
  &lt;label&gt;Comments:&lt;/label&gt;&lt;textarea name="comments" cols="40" rows="5"&gt;
  Document Viewed:&lt;?php echo $thedoc ; ?&gt;
  
  When Accessed:&lt;?php echo $lastacc ; ?&gt;
  &lt;/textarea&gt;
  &lt;input type="submit" name="submit"/&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  &lt;script type="text/javascript"&gt;
  
   $(document).ready(function(){
     myfunc
   });
  
  function myfunc () {
  var frm = document.getElementById("notice");
  frm.submit();
  }
  
  &lt;/script&gt;
  </code></pre>