How to get javascript variable value in php
<p>I want the value of javascript variable which i could access using php. 
i am using the code below but it doesn't return value of that variable in php.</p>

<pre><code>// set global variable in javascript
    profile_viewer_uid = 1;
</code></pre>

<hr>

<pre><code>// php code

$profile_viewer_uid=$_POST['profile_viewer_uid']; 
</code></pre>

<p>this gives me the following error :-
A PHP Error was encountered
Severity: Notice
Message: Undefined index: profile_viewer_uid</p>

<pre><code>// another php code i used which give empty value

$profile_viewer_uid = "&lt;script language=javascript&gt;document.write(profile_viewer_uid);&lt;/script&gt;
</code></pre>

<p>when i echo it shows nothing.           </p>
