It only displays one message rather choosing correct message to display
<p>I am trying to determine questions answered correctly and questions answered incorrectly. If answered correctly then display "Fully Correct" else if incorrect then display the "Incorrect" message. Problem is no matter if correct or not it always displays that question is answered incorrectly.</p>

<p>Below is code:</p>

<pre><code>    $check = true;

    foreach ($studentData['questions'] as $questionId =&gt; $questionData) {

            if($questionData['answer'] == $questionData['studentanswer'])
    {
        echo '&lt;td width="30%" class="studentanswer green"&gt;&lt;strong&gt;'.htmlspecialchars($questionData['studentanswer']).'&lt;/strong&gt;&lt;/td&gt;' . PHP_EOL;
    }
    else
    {
        echo '&lt;td width="30%" class="studentanswer red"&gt;&lt;strong&gt;'.htmlspecialchars($questionData['studentanswer']).'&lt;/strong&gt;&lt;/td&gt;' . PHP_EOL;
        $check = false;
    }


if($check)
{
    echo '&lt;p class="green"&gt;&lt;strong&gt;Fully Correct&lt;/strong&gt;&lt;/p&gt;';
}
else
{
    echo '&lt;p class="red"&gt;&lt;strong&gt;Not Correct / Not Fully Correct&lt;/strong&gt;&lt;/p&gt;';
}

}
</code></pre>
