0

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\MINI PROJECT\CDP\presentationlayer\doctor\index2.php on line 38

The error above is what i get when i click on the doctor's info on my website and it is same for 41,44,47,50.

below is the code;

<?php include ('../../datalayer/server.php'); ?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Doctor</title>
    <link rel="stylesheet"  href="style3.css">
    <link href="https://fonts.googleapis.com/css2?family=Alfa+Slab+One&family=Open+Sans:wght@300&display=swap" rel="stylesheet">
</head>

<header>
    <h1 >Doctor<span>Patient</span></h1>
        <nav>

        <ul>
            <li><a href="index2.php">MyInfo</a></li>
            <li><a href="doctorapp.php">My Appointments</a></li>
            <li><a href=" searchpatient.php">Search Patient</a></li>
            <li><a href="add.php">Add Description</a></li>
            <li><a href="../../consultant/consultant.html">Logout</a></li>
        </ul>
    </nav>
</header>
<body>

    <div class="header">
    <h2>My Information</h2>
</div>
<form method="post" action="index2.php" class="info">
<div class="Dcontent">


    <label>ID: <?php echo "" .isset($_SESSION['DoctorID']);?></label>

           <br>
           <br>
          38. <label> Email : <?php echo $colD['email']; ?></label>
                   <br>
           <br>
          41. <label> Name : <?php echo $colD['Doctorname']; ?></label>
                   <br>
           <br>
          44. <label> Address : <?php echo $colD['Address']; ?></label>
                   <br>
           <br>
          47. <label> Contact Number : <?php echo $colD['ContactNumber']; ?></label>
                   <br>
           <br>
          50. <label> Specialized In : <?php echo $colD['category']; ?></label>
                   <br>
           <br>

  </div>
</form>
<!--<div class="footer">
    <div id="copyright"><small>© 2021 Kwame Nkrumah University of Science & Technology.</small></div>
</div>-->
</body>
</html>
7
  • and line 38 in index2.php is...? You've provided a totally irrelevant code from a wrong file.. Commented Aug 12, 2021 at 0:27
  • Does this answer your question? Trying to access array offset on value of type null Commented Aug 12, 2021 at 0:39
  • 38. <label> Email : <?php echo $colD['email']; ?></label> Commented Aug 12, 2021 at 0:39
  • looks like your $colD variable is null Commented Aug 12, 2021 at 0:41
  • Please. null as in? Commented Aug 12, 2021 at 0:45

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.