Why can't I get the value of the element? sorry I'm new at coding and trying to learn
 <script>
        function getdll() {
            document.getElementById('lblmess').innerHTML =
                (formid.listid[formid.listid.selectedIndex].value)
            $element = document.getElementById("lblmess");
            console.log($element.innerHTML)
        }
    </script>
    
    <form name="formid">
        <select class="custom-select" name="listid" onchange="getdll()">
            <option value="0"></option>
            <?php
            $hall_qry = $conn->query("SELECT * FROM `office_hall` WHERE o_id !=0  order by `office_name` asc");
            while ($row = $hall_qry->fetch_assoc()) : ?>
    
                <option value="<?php echo $row['o_id'] ?>"><?php echo $row['office_name'] ?></option>
            <?php
            endwhile;
            ?>
        </select>
        <br><br>
        <select class="custom-select">
            <?php
            $hall_qry = $conn->query("SELECT * FROM `assembly_hall` WHERE o_id = '$element' order by `room_name` asc");
            while ($row = $hall_qry->fetch_assoc()) : ?>
    
                <option value="<?php echo $row['id'] ?>"><?php echo $row['room_name'] ?></option>
            <?php
            endwhile;
            ?>
        </select>
<label id="lblmess"></label>
    </form>
this is where I use this code sorry if my coding id is like that .............................................................
 
     
    