Fixing Errors in php
<p>I have been getting the following errors in my php file:</p>

<p>Notice: Undefined index: errStr in /clientdata/zeus-dynamic-1/c/r/crowndoor.com.au/www/crowntest/contact.php on line 13</p>

<p>Notice: Undefined index: sent in /clientdata/zeus-dynamic-1/c/r/crowndoor.com.au/www/crowntest/contact.php on line 20</p>

<p>which appear at the top of the browser window.
I have tried turning off notices using: error_reporting(E_ALL ^ E_NOTICE); but it doesn't seem to make any difference. I am now attempting to fix the undefined indexes. my php is as follows: </p>

<pre><code>&lt;?php
session_name("fancyform");
session_start();


$_SESSION['n1'] = rand(1,20);
$_SESSION['n2'] = rand(1,20);
$_SESSION['expect'] = $_SESSION['n1']+$_SESSION['n2'];


$str='';
if($_SESSION['errStr'])
{
    $str='&lt;div class="error"&gt;'.$_SESSION['errStr'].'&lt;/div&gt;';
    unset($_SESSION['errStr']);
}
if (!isset($_POST['errStr'])) 
{
//If not isset -&gt; set with dumy value 
$_POST['errStr'] = "undefine"; 
}

$success='';
if($_SESSION['sent'])
{
    $success='&lt;h1&gt;Thank you!&lt;/h1&gt;';

    $css='&lt;style type="text/css"&gt;#contact-form{display:none;}&lt;/style&gt;';

    unset($_SESSION['sent']);
}
?&gt;
</code></pre>

<p>If anyone has any thoughts about how to fix these notices from appearing that would be great.</p>
