undefined index on $_SESSION variables
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index">PHP: “Notice: Undefined variable”  and “Notice: Undefined index”</a>  </p>
</blockquote>



<p>Below I have a code where I am using session variables to retrieve data from a query which is recieving data from another page:</p>

<pre><code>if (isset($_POST['module']))
{
    $query = "SELECT ModuleNo, ModuleName FROM Module WHERE ModuleId = ?";

    $stmt = $mysqli-&gt;prepare($query); //line 99

    $stmt-&gt;bind_param('s', $_POST['module'] );

    if ( $stmt-&gt;execute() )
    {   
        $stmt-&gt;bind_result($moduleno, $modulename); 

        $stmt-&gt;fetch();

        $_SESSION['module'] = $_POST['module'];
        $_SESSION['moduleNo'] = $moduleno;
        $_SESSION['moduleName'] = $modulename;
    }
}

.....


&lt;p&gt;{$_SESSION['moduleNo']}  {$_SESSION['moduleName']}&lt;/p&gt; //line 1658
</code></pre>

<p>Problem is that it is giving me these two undefined errors:</p>

<pre><code>Notice: Undefined index: moduleNo in ... on line 1658 Notice: 
Undefined index: moduleName in ... on line 1658 
</code></pre>

<p>My question is that how can I get rid of this notice? (I don't mean get rid of it by using @ by the way, I meant by fixing it)</p>

<p>I am also getting these errors below:</p>

<pre><code>Notice: Undefined variable: mysqli in ... on line 99 
Fatal error: Call to a member function prepare() on a non-object in ... on line 99 
</code></pre>
