How to use a PHP variable in JavaScript?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/5310216/passing-php-variable-into-javascript">Passing PHP variable into JavaScript</a>  </p>
</blockquote>



<p>I want to obtain a PHP variable, to use it in an <code>if</code>-condition in JavaScript.</p>

<p>I was trying to use it like this: </p>

<pre><code>var phpLogin = &lt;?php $_SESSION['login'] ?&gt;;
</code></pre>

<p>But it's wrong in syntax terms. So, how can I use a PHP variable in JavaScript?</p>
