it is not suppose to let the user view the form if they are logged out
<p>I am not sure why this is not working but what I am trying to say in the code below is that if the user is not logged in <code>if ((!isset($username)) &amp;&amp; (!isset($userid))){</code>, then view the form else if they are logged in then display message stating they they must be logged out to view the page.</p>

<p>Problem is though is that even though the user is logged in, it still displays the form and not the message.</p>

<p>Below is the code:</p>

<pre><code>        &lt;?php
ini_set('display_errors',1); 
 error_reporting(E_ALL);
        session_start();

        include('member.php');

  $user = (isset($_POST['user'])) ? $_POST['user'] : '';
  $email = (isset($_POST['email'])) ? $_POST['email'] : '';

        if ((!isset($username)) &amp;&amp; (!isset($userid))){

            echo "&lt;form action='./forgotpass.php' method='post'&gt;
            &lt;table&gt;
            &lt;tr&gt;
            &lt;td&gt;&lt;/td&gt;
            &lt;td id='errormsg'&gt;$errormsg&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
            &lt;td&gt;Username&lt;/td&gt;
            &lt;td&gt;&lt;input type='text' name='user' /&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
            &lt;td&gt;Email&lt;/td&gt;
            &lt;td&gt;&lt;input type='text' name='email' /&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
            &lt;td&gt;&lt;/td&gt;
            &lt;td&gt;&lt;input type='submit' name='resetbtn' value='Reset Password' /&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;/table&gt;
            &lt;/form&gt;";

        }
        else
        {
        echo "Please Logout to view this Page.";    
        }
        ?&gt;
</code></pre>

<p>In top of the code above I am including the member.php page and I don't know if this makes a big difference but the code for the member.php page is below:</p>

<pre><code>&lt;?php

if (isset($_SESSION['teacherforename'])) {

$_SESSION['teacherforename'] = $_SESSION['teacherforename'];

}

if (isset($_SESSION['teachersurname'])) {

$_SESSION['teachersurname'] = $_SESSION['teachersurname'];

}

if (isset($_SESSION['teacherid'])) {

      $userid = $_SESSION['teacherid'];

  }

if (isset($_SESSION['teacherusername'])) {

      $username = $_SESSION['teacherusername'];

  }

        ?&gt;
</code></pre>
