注意:未定义的索引:PHP会话中的电子邮件错误[重复]

I keep getting this error even though I checked my code over dozens of times.

Here I even define SESSION on top as global before using but I keep getting the same error.

<?php if(!isset($_SESSION)) {session_start();}  ?>

Then I use this line of code

<?php error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);?>

It removes the Notice: Undefined index:email error but the email column remains in blank in the database whenever I insert the data.

It says error on this lines of coding.

$s="insert into donation(ddate,units,detail,email) values('" . $d ."' ,'" . $_POST["t3"]
     . "','" . $_POST["t4"] . "','". $_SESSION["email"] ."')";
</div>

try to echo ur session value so u can know u get session value or not...

after session_start();

echo $_SESSION['email'];

you have to use session_start(); before applying conditions with $_SESSION. Your code should be :

<?php session_start(); if(!isset($_SESSION)) { //DO SOMETHING HERE } 
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);

 $s="insert into donation(ddate,units,detail,email) values('" . $d ."' ,'" . 
 $_POST["t3"]
 . "','" . $_POST["t4"] . "','". $_SESSION["email"] ."')";
 ?>