使用输入类型检索数据

Hello I would like to retrieve data into a single form without clicking submit forms, it that possible ?

<?php
    $stmt = $db_con->prepare("SELECT * FROM userinfo WHERE role='student' AND gradelvl='7' ORDER BY lrnno ASC");
    $stmt->execute();
    $row=$stmt->fetch(PDO::FETCH_ASSOC);
?>

and this is the html code for displaying value

<input type="text"  name="studname"><?php echo $row['studname']; ?> </input>

studname is included in userinfo table Please help

Should be

<input type="text"  name="studname" value="<?php echo $_POST['studname']; ?>"></input>