Weird undefined index errors
<p>I have a few variables that are assigned the values of session variables (See the first four)--dbfunctions.php:</p>

<pre><code>&lt;?php 
    include_once('functions.php'); 

function newAdminCivilReport(){

$userId = $_SESSION['userId'];
$judge = $_SESSION['judgeID'];
$month = $_SESSION['month'];
$year = $_SESSION['year'];

$con = mysql_connect("-","-","-");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
else {
    // connected to database successfully
}
mysql_select_db("casemanagers", $con);
$PendingCivil = mysql_real_escape_string($_POST['PendingCivil']);
$PendingAsbestos = mysql_real_escape_string($_POST['PendingAsbestos']);
$PendingDomestic = mysql_real_escape_string($_POST['PendingDomestic']);
$AsgNewCivil = mysql_real_escape_string($_POST['AsgNewCivil']);
$AsgNewCivil = mysql_real_escape_string($_POST['AsgNewCivil']);
$AsgNewAsbestos = mysql_real_escape_string($_POST['AsgNewAsbestos']);
$AsgNewDomestic = mysql_real_escape_string($_POST['AsgNewDomestic']);
$AsgTransferCivil = mysql_real_escape_string($_POST['AsgTransferCivil']);
$AsgTransferAsbestos = mysql_real_escape_string($_POST['AsgTransferAsbestos']);
$AsgTransferDomestic = mysql_real_escape_string($_POST['AsgTransferDomestic']);
$AsgReopenedCivil = mysql_real_escape_string($_POST['AsgReopenedCivil']);
$AsgReopenedAsbestos = mysql_real_escape_string($_POST['AsgReopenedAsbestos']);
$AsgReopenedDomestic = mysql_real_escape_string($_POST['AsgReopenedDomestic']);
$DispTOCivil = mysql_real_escape_string($_POST['DispTOCivil']);
$DispTOAsbestos = mysql_real_escape_string($_POST['DispTOAsbestos']);
$DispTODomestic = mysql_real_escape_string($_POST['DispTODomestic']);
$clerkITNumber = mysql_real_escape_string($_POST['clerkITNumber']);


$query = "INSERT INTO `casemanagers`.`civil` (`JudgeID`, `Month`, `Year`, `PendingCivil`, `PendingAsbestos`, `PendingDomestic`, `AsgNewCivil`, `AsgNewAsbestos`, `AsgNewDomestic`, `AsgTransferCivil`, `AsgTransferAsbestos`, `AsgTransferDomestic`, `AsgReopenedCivil`, `AsgReopenedAsbestos`, `AsgReopenedDomestic`, `DispWOPCivil`, `DispWOPAsbestos`, `DispWOPDomestic`, `DispFinalCivil`, `DispFinalAsbestos`, `DispFinalDomestic`, `DispBTCivil`, `DispBTAsbestos`, `DispBTDomestic`, `DispJTCivil`, `DispJTAsbestos`, `DispJTDomestic`, `DispTOCivil`, `DispTOAsbestos`, `DispTODomestic`, `OldCivil`, `OldAsbestos`, `OldDomestic`, `userID`, `clerkITNumber`) VALUES ($judge, $month, $year, $PendingCivil, $PendingAsbestos, $PendingDomestic, $AsgNewCivil, $AsgNewAsbestos, $AsgNewDomestic, $AsgTransferCivil, $AsgTransferAsbestos, $AsgTransferDomestic, $AsgReopenedCivil, $AsgReopenedAsbestos, $AsgReopenedDomestic, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, $DispTOCivil, $DispTOAsbestos, $DispTODomestic, 0, 0, 0, $userId, $clerkITNumber);";
mysql_select_db("casemanagers", $con);

$result = mysql_query($query);
return $result;
mysql_close($con);
}
?&gt;
</code></pre>

<p>These values are in a function in a separate file. When I use the function (which inserts a whole bunch of items in a database), everything, including the proper values for the variables above, gets inserted into the database successfully. However, I'm still getting:</p>

<p><strong>Notice: Undefined index: judgeID in c:\Inetpub\wwwroot\CaseManagement\dbfunctions.php on line 6</strong></p>

<p><strong>Notice: Undefined index: month in c:\Inetpub\wwwroot\CaseManagement\dbfunctions.php on line 7</strong></p>

<p><strong>Notice: Undefined index: year in c:\Inetpub\wwwroot\CaseManagement\dbfunctions.php on line 8</strong></p>

<p>I can't figure out why. The variables work as they should. </p>

<p>main.php:</p>

<pre><code>&lt;?php


session_start();

   include_once('dbfunctions.php');
   include_once('functions.php');
    $result = newAdminCivilReport();

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