$answers = ambilJawabanUSER($simpanID,$conn); // function to save the answer from database table
$userAnswer = $_POST['answers'];
foreach( $userAnswer as $getAnswer ) {
if ($userAnswer == $answers){
echo "correct";
else{
echo "wrong";
}
}
我的代码与上面的代码类似,但它在我的情况下不起作用。有人有解决方案吗?
答案 0 :(得分:0)
我认为您在代码中有一个错误。你应该尝试这个代码
$answers = ambilJawabanUSER($simpanID,$conn); // function to save the answer from database table
$userAnswer = $_POST['answers'];
foreach( $answers as $getAnswer ) {
if ($userAnswer == $getAnswer){
echo "correct";
}else{
echo "wrong";
}
}