I have use session_start() but still session is not creating

  php, session

I have used session_start() stil session not creating as i am getting error like
Undefined variable $_SESSION in C:xampphtdocscollwebbcaform.php on line 61,
Trying to access array offset on value of type null,
plzz help

<?php

    if($_SERVER["REQUEST_METHOD"] == "POST" ){ 
        include 'formfill.php'; 
        $useremail = $_POST['email'];
        $pass = $_POST['password'];

        $existsql = "SELECT * FROM `details` WHERE email = '$useremail'";
        $result = mysqli_query($conn,$existsql);
        $numrows = mysqli_num_rows($result);
        if($numrows == 1){
            $row  = mysqli_fetch_assoc($result);
            $user = $row['username'];
            $email = $row['email'];
            if(password_verify($pass,$row['password'])){
                session_start();
                $_SESSION['loggedin'] = true;
                $_SESSION['useremail'] = $email;
                $_SESSION['user'] = $user;
                $name = $_SESSION['user'];
                $emol = $_SESSION['useremail'];
                header("Location:/collweb/index.php?loginsuccess=true");
                exit();
            }
            else{
                $showerror = "Incorrect Credentials";
                header("Location:/collweb/index.php?loginsuccess=false&error=$showerror");
            }
        }
        }
        else{
            $showerror = "Incorrect Credentials";
            header("Location:/collweb/index.php?loginsuccess=false&error=$showerror");
        }
        ?>

Source: Ask PHP

LEAVE A COMMENT