提问人:shiva7890 提问时间:3/24/2019 最后编辑:nice_devshiva7890 更新时间:3/24/2019 访问量:1431
未定义索引:具有$GLOBAL变量的类型
Undefined index:Type with $GLOBAL variable
问:
我设置了一个超级全局变量,但在另一个文件中,在运行程序时无法访问该变量。$GLOBALS['Type']="JobSeeker"
Undefined Index:Type
第1页.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';
邮件发送.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']="";
}
}
我尝试使用不同的名字,但没有得到任何解决方案。
答: 暂无答案
评论
echo "<pre>";print_r($GLOBALS);