Hello,
with the following code I am able to pass a variable from js to php.
<script> var winW = 630, winH = 460; if (document.body && document.body.offsetWidth) { winW = document.body.offsetWidth; winH = document.body.offsetHeight; } if (document.compatMode=='CSS1Compat' && document.documentElement && document.documentElement.offsetWidth ) { winW = document.documentElement.offsetWidth; winH = document.documentElement.offsetHeight; } if (window.innerWidth && window.innerHeight) { winW = window.innerWidth; winH = window.innerHeight; } </script> <?php $screen_width = "<script>document.write(winW)</script>"; $screen_height = "<script>document.write(winH)</script>"; ?>
Problem:
it is passed as a string and I need it to be passed as an integer.
When I try (int) or intval() in php, it is set to variable type int, but it loses it value.
Can anyone help?