My 1st post.
I'd like to place the user's local time (obtained via javascript) into a ProcessWire php variable.
I've tried using $session:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="<?php echo $config->urls->templates?>scripts/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
document.ready = function() {
var visitortime = new Date();
"<?php echo $session->time; ?>" + "=" + visitortime;
};
</script>
</head>
<body>
<?php $t = $session->time; echo $t; ?>
</body>
</html>
and $input with a hidden form submitted by javascript:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="<?php echo $config->urls->templates?>scripts/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
document.ready = function () {
var visitortime = new Date();
document.getElementById("utoffset").setAttribute("value",visitortime);
document.getElementById("utoffset").submit();
}
</script>
</head>
<body>
<form action="." method="post">
<input type="hidden" id="utoffset" name="vt">
</form>
<?php echo $input->post->utoffset; ?>
</body>
</html>
Both display blank pages (using the above .php files as templates).
Does anyone see what I'm missing? Or is there an easier way? Completely baffled.