title: Retrieving javascript output from a form via php
body: <p>I have a hidden field in a form where I'm trying to grab the users screen resolution. Then on the processing end retrieve the screen resolution via php. Unfortunately, my understanding of javascript is pretty limited. Here is what I have. I would really appreciate any help.</p>
  
  <pre><code>&lt;head&gt;
      &lt;script type="text/javascript"&gt;
          function xy(){
              document.write(screen.width + "x" + screen.height);
              document.getElementById('xy').value;
              }           
      &lt;/script&gt;
  &lt;/head&gt;
  
  
  
  
  &lt;form action="" method=post &gt;
  
      //other fields here
  
      &lt;input type="hidden" name="xy" id="xy" value=""/&gt;
      &lt;input type=submit name="button" value="button" /&gt; 
  &lt;/form&gt;
  </code></pre>
  
  <p>When I view the page's source code, shouldn't I see the value set to for example "1366x768"? Now on the processing side, I would like to pull out information with php like this. </p>
  
  <pre><code>if(isset($_POST['xy']) &amp;&amp; (!empty($_POST['xy'])){
   $blah = $_POST['xy'];
   //sanatize $blah;
      }
  </code></pre>