Jump to content

edwinv

New Members
  • Posts

    1
  • Joined

  • Last visited

edwinv's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.