how to fix this undefined variable
<p>On a Previous page the user enters in a number in the textbox, when that form is submitted, the number is posted on this page as <code>$_SESSION['sessionNum']</code>. Now I want to store this number on the top as <code>$sessionMinus</code> showing the same number except difference is that everytime this form is submitted to it self, the number counts down by 1 everytime the form is submitted. Problem is that it is giving me an undefined variable <code>$sessionMinus</code>. How can this be fixed?</p>

<pre><code>  &lt;?php
session_start();
//validate the post data if necessary
if (isset($_POST['sessionNum'])) {

$_SESSION['sessionNum'] = $_POST['sessionNum'];
}else{
        $_SESSION['sessionNum']--;
}

$sessionMinus = $_SESSION['sessionNum'];

?&gt;


    &lt;body&gt;

    &lt;?php echo $sessionMinus; ?&gt;

      &lt;form id="enter" 
                action="&lt;?php echo htmlentities($_SERVER['PHP_SELF']); ?&gt;" 
                method="post" 
                onsubmit="return validateForm(this);" &gt;
        &lt;p&gt;
            &lt;input id="submitBtn" name="submitDetails" type="submit" value="Submit Details" /&gt;
        &lt;/p&gt;
      &lt;/form&gt; 

      &lt;?php

      $outputDetails = "";
      $outputDetails .= "
      &lt;table id='sessionDetails' border='1'&gt;
      &lt;tr&gt;
      &lt;th&gt;Number of Sessions:&lt;/th&gt; 
      &lt;th&gt;{$_SESSION['sessionNum']}&lt;/th&gt;
      &lt;/tr&gt;";
      $outputDetails .= "&lt;/table&gt;";

      echo $outputDetails;

      ?&gt; 

    &lt;/body&gt;
</code></pre>
