if this is not working I would question whether the javascript is properly sending the value to the hidden form element.
to troubleshot, add the following code at line one of your page:
<?php
error_reporting(E_ALL);
ini_set('display_errors','on');
?>
<?php
if($_SERVER['REQUEST_METHOD'] =="POST") {
echo("<pre>");
var_dump($_POST);
echo("</pre>");
}
?>
this will turn error reporting on so we can see any errors that are occurring, and output the posted values from the form (this is going to cause the headers already sent error to occur, but we can ignore that one) so we can see if the hidden element is being populated by the script..