Friday 15 March 2013

how to get value from javascript to php -


I am using the following code to get the screen resolution.

This works fine with the WAMP server but when I put it on a remote Linux server, $ height returns 0 .

HTML / PHP
  & lt; Head & gt; .... & lt; Script language = "javascript" & gt;   
  var y = window.screen.availHeight; Var x = window.screen.availWidth; Window.location.href = "index.php? Height =" + y + "and width =" + x; break;   

  & lt; / Head & gt;   
  & lt ;? Get Php $ height = $ _ ['height']; $ Height = intval ($ height); Echo ($ height); ? & Gt;    

You can explain what you are trying to do with this webpage The overall explanation of passing in height for PHP is because this page is not working at all, it is the execution flow that is with this web page.

  1. The user enters index.php in the address bar.
  2. PHP server handles the request.
  3. There will be no value at $ height.
  4. Calling interval ($ height) when $ height is empty, will return 0.
  5. The page will be loaded, 0 will be displayed.
  6. Javascript is executed.
  7. The URL will be created with parameters of height and width.
  8. The browser will throw an error: Unwanted syntax error: Invalid Pause Statement
  9. Expiration ends.

No comments:

Post a Comment