Неопределенный индекс: тип с переменной $ GLOBAL - PullRequest
0 голосов
/ 24 марта 2019

Я установил супер глобальную переменную $GLOBALS['Type']="JobSeeker", но в другом файле эта переменная недоступна, пока запущенная программа получает Undefined Index:Type.

page1.php

$con = mysqli_connect("localhost","root","","job1");
// Specify the query to execute
$sql = "select * from JobSeeker_registration where JobSeekerId='".$ID."'  ";
// Execute query
$result = mysqli_query($con,$sql);
// Loop through each records 
$row = mysqli_fetch_array($result);


$GLOBALS['Name']=$row['JobSeekerName'];

$GLOBALS['Email']=$row['Email'];

$GLOBALS['Approval']="Confirm";

$GLOBALS['Type']="JobSeeker";
.
.
.
.
include '../Mailing/MailSending.php';

MailSending.php:

if($GLOBALS['Type']=="JobSeeker")  //Here is Error:-Undefined Index of Type
{
    if($GLOBALS['Approval']=="Pending")
    {
        $UserName=$GLOBALS['Email'];
        $mail->addAddress($UserName, $GLOBALS['Name']);
        $mail->Subject = 'Registration Mail';
        $mail->msgHTML(file_get_contents("Mailing/Pending.html"), __DIR__);
        $GLOBALS['Email']="";
        $GLOBALS['Type']="";
        $GLOBALS['Name']="";
        $GLOBALS['Approval']="";
    }
    elseif ($GLOBALS['Approval']=="Confirm") 
    {
        $UserName=$GLOBALS['Email'];
        $mail->addAddress($UserName, $GLOBALS['Name']);
        $mail->Subject = 'Registration Confirmation Mail';
        $mail->msgHTML(file_get_contents("Mailing/Confirm.html"), __DIR__);
        $GLOBALS['Email']="";
        $GLOBALS['Type']="";
        $GLOBALS['Name']="";
        $GLOBALS['Approval']="";
    }
}

Я пробовал с разными именами, но не нашел решения.

...