How do I use a php variable which is transferred from one file (search.inc.php) into another (anotherpage.php) in if statement?
My connection with MySQL is correct but I can't use variable $bilkon (which is picked up from MySQL) in if statement in anotherpage.php.
When echo $bilkon  in anotherpage.php, I see the "Yes" response, but when I use this $bilkon in if statement I don't get the correct response. I got the "Bad" response from the if statement although I got on echo answer "Yes".
search.inc.php
<?php
session_start();
require 'connect.php'; 
if(isset($_GET['search_text'])){
    $search_text = $_GET['search_text'];
    if(!empty($search_text)){
        $query="SELECT * FROM kon WHERE sifkon LIKE '%$search_text%'";
        $query_run = mysqli_query($con, $query);
        while($query_row = mysqli_fetch_assoc($query_run)){
            echo $sifkon='<a href="anotherpage.php?search_text='.$query_row['sifkon'].'">'.$query_row['sifkon'].'  '.'</a>';
            echo $nazkon = $query_row['nazkon'].'<br>';
            $bilkon = $query_row['bilkon'].'<br>';
            $strknj = $query_row['strknj'].'<br>';
            $devknj = $query_row['devknj'].'<br>';
            $orjkon = $query_row['orjkon'].'<br>';
            $tiporj = $query_row['tiporj'].'<br>';
            $_SESSION['test']=$bilkon;
        }
    }
}
?>
anotherpage.php
<?php
include 'search.inc.php';
echo  $_SESSION['test'];//Yes
if ($_SESSION['test'] == 'Yes'){
    echo 'Good';
}else {
    echo 'Bad';
}
?>
 
    