Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6603339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:59:45+00:00 2026-05-25T18:59:45+00:00

I have a few variables that are assigned the values of session variables (See

  • 0

I have a few variables that are assigned the values of session variables (See the first four)–dbfunctions.php:

<?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);
}
?>

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:

Notice: Undefined index: judgeID in c:\Inetpub\wwwroot\CaseManagement\dbfunctions.php on line 6

Notice: Undefined index: month in c:\Inetpub\wwwroot\CaseManagement\dbfunctions.php on line 7

Notice: Undefined index: year in c:\Inetpub\wwwroot\CaseManagement\dbfunctions.php on line 8

I can’t figure out why. The variables work as they should.

main.php:

<?php


session_start();

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

?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:59:46+00:00Added an answer on May 25, 2026 at 6:59 pm

    session_start() must be the very first thing in your PHP. So it needs to be:

    <?php
       session_start(); // <=== this MUST be first
       include_once('dbfunctions.php');
       include_once('functions.php');
    
        $result = newAdminCivilReport();
    
    ?>
    

    EDIT:
    Variables in PHP functions are local unless declared otherwise, so make the following change to dbfunctions.php:

    function newAdminCivilReport(){
        global $_SESSION; // <==== add this line at the start
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a sql function and i need to declare few variables in that
Straightforward question: I have a few variables that are doubles. I would like to
I have a few data values that I need to store on my rails
i have a header file global.h where i declare a few variables that i
I have a series of variables that have a decimal point and a few
I have a SELECT statement (see below) that gets a few items from the
I have a script that calls another php page and passes values using PHP
I have a few $_SESSION variables that keep track of what page the user
I have two questions: 1) I have a few global variables for my website
I have seen quite a few ways to output variables. Which of these ways

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.