Assign javascript value to php variable
<p>I'm trying to check screen width and assign it to a php variable to do some if else statements. This is what I got. </p>

<pre><code>&lt;script&gt;
    var mobileFormWidthCheck = $(window).width();
    var mobileFormReady;
    if(mobileFormWidthCheck &lt; 767){
        mobileFormReady = 22;
    }
    else{
        mobileFormReady = 55;  
    }

&lt;/script&gt;

    &lt;?php   
        $widthChecked = "&lt;script&gt;document.write(mobileFormReady);&lt;/script&gt;";
        echo $widthChecked;
    ?&gt;
</code></pre>

<p>This works perfectly. But when I try to echo something based on the <code>mobileFormReady</code> value, it doesnt echo. </p>

<p>This is what im trying to get to work.</p>

<pre><code>$widthChecked = "&lt;script&gt;document.write(mobileFormReady);&lt;/script&gt;";
if($widthChecked == "22"){
  echo 'this page is under 767 pixels';
}
else if($widthChecked == "55"){
  echo 'this page is OVER 767 pixels';
}
else{
  echo 'NOT WORKING YET';
}
</code></pre>

<p>I think its a string integer issue. But I cant seem to figure it out. Can you guys please help me? Thanks a lot.</p>
