How to fix “Undefined Array Key ‘id’ Error” of the Dashboard Page (After Login)? [duplicate]

Can anyone help me how to fix the Undefined Array Key ‘id’ Error in Dashboard Page (Welcome Page) After Redirect from Login Page?
Thank You…

In Login Page:

<?php 
    session_start(); 
    if(isset($_POST['submit'])) { 
    extract($_POST); 
    include 'database.php'; 
    $sql = mysqli_query($conn,"SELECT * FROM registration where regno='$regno' and pass='$pass'"); 
    $row = mysqli_fetch_array($sql); 

    if(is_array($row)) { 
    if($_SESSION["captcha"] == $_POST["captcha"]) {

    $_SESSION["id"] = $row['id'];  
    header("Location: dashboard.php"); 

    } else {
    echo "Invalid CAPTCHA Code!";
    }} else {
    echo "Invalid Reg ID or Password!";
    }
    }
?>

Where $regno = Registration Number, $pass = Password & “captcha” = CAPTCHA Code

I’ve tried in Dashboard Page:

<?php
    session_start();
    include 'database.php';
    $id = $_SESSION["id"];
    $sql = mysqli_query($conn,"SELECT * FROM registration where id='$id'");
    $row = mysqli_fetch_array($sql);

    if(!isset($_SESSION['id'])){
    header("Location: login.php");
    exit();
    }
?>

It shows “Undefined Array Key ‘id’ Error” in dashboard.php
Any help?