我无法使用php在我的测验系统上查看我的正确分数

Hi guys I need some help I am newbie in PHP and I am having a trouble with this code. It does not compute the correct answer. Please help me. here is my code

<form action="" method="post">
    <?php
    $f = $dbcon->query("SELECT * FROM fill_blank WHERE quiz_id = '25'") or   die(mysqli_error()); 
    while($question = $f->fetch_assoc()):
    ?>
        <div>
            <p><?php echo $question['question_title']; ?></p>
            <input type="text" name="answers[<?php echo $question['question_id'] ?>]" id="">
        </div>
    <?php endwhile;?>
    <br>
    <input type="submit" value="Submit">
</form>

<?php
if( isset( $_POST['answers'] ) ) {
    $answers = $_POST['answers'];
    $score = 0;
    foreach( $answers as $key => $answer ) 
    {
        // check user answer compared to correct answer using key
        if( $answer == $question[$key]['question_answer'] ) 
        {
            $score = $score + 1;
        }
    }
    echo 'Your score is '.$score.'';
}
?>

It always display Your score is 0.