Javascript function and PHP session variable
<p>I have the following script in my Body Tag inside a PHP page:</p>

<pre><code>&lt;script type="text/javascript"&gt;
function goNext()
{
    &lt;?php
       if(isset($_SESSION['current']))
       {
    ?&gt;
    window.location="step2.php";
    &lt;?php
      }
       else
      {
    ?&gt;
      alert('Please select one item to continue.');
    &lt;?php
      }
    ?&gt;
}
&lt;/script&gt;
</code></pre>

<p>I am setting the session vaible in PHP.
So when I click a link on the page, the session is set.
After that, when I call this function, it still goes to the Alert.</p>

<p>If I refresh the page, then it skips the alert and forwards to the URL mentioned in the function.</p>

<p>Any idea why while I have not refreshed the page, it does not go to the URL?</p>

<hr>

<p>Update</p>

<hr>

<p>I am already setting the Session_start at the begining of the page.
The session is getting set properly, because when I refresh, I can see it working.
Thirdly, I am already using AJAX to set sessions without doing page refresh.
There are other elements on the screen that respond to session change and they are working.
Its only this function where the "issset" function is not detecting the session.</p>
