hii guys

I'm beginer I have one page of mailsent I want to uses this for both customer and administrator

to veiws information from the database.so what is the right way of writening a query to avoid error
because when I write this query "$result = mysqli_query($con,"SELECT * FROM mail where senderid= '$_SESSION[customerid]'");"
when customer start session on login has no error but when I login as admin this error occours
//
Notice: Undefined index: customerid in C:\xampp\htdocs\design\mailisent.php on line 11

the same error occour when I change it to adminid in the customer page when its login
//

Notice: Undefined index: adminid in C:\xampp\htdocs\design\mailisent.php on line 11

please i need yoour help my code is below

//code
<?php
include("header.php");
include("dbconnection.php");
?>
<?
if(isset($_GET["mailid"]))
{
mysqli_query($con,"DELETE FROM mail where mailid='$_GET[mailid]'");
$recres = "Mail deleted Successfully...";
}
$result = mysqli_query($con,"SELECT * FROM mail where senderid= '$_SESSION[customerid]'");
?>

<div id="tem_main">
<div align="center"><span class="main_top"></span>

</div>
<div align="center"></div>
<div id="tem_content">
<h2 align="center">Sent Mails</h2>
<?php
global $recres;
echo $recres; ?>
<table width="600" border="1">

<?php
echo " <tr>";
echo " <th scope='col' width='45' >Delete</th>";
echo " <th scope='col'>SENDER</th>";
echo " <th scope='col'>SUBJECT</th>";
echo " <th scope='col'>TIME</th>";
echo " </tr>";
while($row = mysqli_fetch_array($result))
{
echo " <tr>";
echo " <th scope='col'><a href='mailinbox.php? mailid=$row[mailid]'>Delete</a></th>";
echo " <th scope='col'>$row[senderid]</th>";
echo " <th scope='col'>$row[subject]</th>";
echo " <th scope='col'>$row[mdatetime]</th>";
echo " </tr>";
}
?>
</table>
</form>