Using PHP sessions to change change html menu items
<p>I'm trying to create a session once a user logs in so that the 'log in' menu item changes to 'log out' for the duration they are logged in. Once logged in, my success.php file runs which is just</p>

<pre><code>&lt;?php
    session_start();
    $_SESSION['loggedin'] = 1;
?&gt;
</code></pre>

<p>Now under the menu I have</p>

<pre><code>&lt;?php
if($_SESSION['loggedin']=1)
echo '&lt;a href="logout.php"&gt;Logout&lt;/a&gt;';
else
echo '&lt;a href="login.html"&gt;Login&lt;/a&gt;';
?&gt;
</code></pre>

<p>I also have a logout page which is just </p>

<pre><code>&lt;?php
    session_start();
    session_destroy();
?&gt;
</code></pre>

<p>What's happening here though is that by default, the logout option is showing rather than log in even though the user hasn't yet logged in to create the session.</p>

<p>I'm not sure if this is the correct way of handling this, but some advice is very much appreciated.</p>

<p>Thanks.</p>
