Create the form
<form id="my_form_name" name="my_form_name" method="post" action="http://www.mydomain.com/destination_page.php">
<input type="hidden" name="form_parameter1" id="form_parameter1" value="" />
<!-- etc... -->
</form>
Create the variable
<script type="text/javascript">
var parameter1 = 'TEST';
</script>
To load the form field with the varaible
document.getElementById('form_parameter1').value=parameter1;
//If you want to auto submit the form
document.forms["my_form_name"].submit();
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.