title: POSTDATA not being passed using javascript submit() function
body: <p>I'm trying to write a form that will update the hidden field values and then submit, after which the values will be input into the mysql database. However, while the form does seem to submit, the $_POST array seems to be empty and i get "unidentified index" errors whenever i try to access any of the $_POST elements??</p>
  
  <p>The relevant code is as follows:</p>
  
  <pre><code>&lt;?php
  if(isset($_GET['a'])){
  $title = $_POST['left'];
  $sql = "UPDATE boxes SET topx = '".$_POST['left']."', topy = '".$_POST['top']."', width = '".$_POST['width']."', height = '".$_POST['height']."' WHERE id = '2'";
      // this is where I get "unidentified index" errors
  mysql_query($sql);
  }
  else {
  $title = "test";
  }
  ?&gt;
  </code></pre>
  
  <p>the JS function to fill the hidden fields and submit the form:</p>
  
  <pre><code>&lt;script type = "text/javascript"&gt;
  function dosmt(form){
  JStopx = dd.elements.field2.x; alert(JStopx);
  JStopy = dd.elements.field2.y; alert(JStopy);
  JSwidth = dd.elements.field2.w; alert(JSwidth);
  JSheight = dd.elements.field2.h; alert(JSheight);
  alert("test2");
  
  alert(document.getElementById('top').value);
  document.getElementById('top').value = JStopy; alert("test1");
  document.getElementById('left').value = JStopx;
  document.getElementById('width').value = JSwidth;
  document.getElementById('height').value = JSheight;
  alert("waah");
  location = "http://127.0.0.1/experiment/index.php?a=true";
  alert ("OK"); 
  document.getElementById('testform').submit();
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>and the form:</p>
  
  <pre><code>&lt;form name = 'testform' method = "post" id = 'testform' action = "index.php"&gt;
  &lt;input type = "hidden" name = 'top' id = 'top' value = ''/&gt;
  &lt;input type = "hidden" name = 'left' id = 'left' value = ''/&gt;
  &lt;input type = "hidden" name = 'width' id = 'width' value = ''/&gt;
  &lt;input type = "hidden" name = 'height' id = 'height' value = ''/&gt;
  &lt;input type = "hidden" name = 'placeholder' id = 'placeholder' value = 'blah'/&gt;
  &lt;input type = "button" name = 'update' id = 'update' value = "Update" onClick = 'dosmt(this.form)'&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Any help would be appreciated, thanks!</p>