I just finished working out a solution to someone's problem. and now I cannot find their question. So, I'm not going to let my work go to waste so I'll put my answer here: To get javascript screensize to go into a hidden php form, do this:
<?php
$screen = "<script>document.write(screen.width)</script>";
?>
<form action="nextpage.php" method="post">
<input type="hidden"
name="mysecretscreensize"
value="<?php print $screen; ?>">
<input type="submit">
</form>