Hii guys. REALLY NEED UR HELP on my php programming. just wanted to ask what's wrong with my code that everytime i view it on google chrome, it displays '0 points', it should display '5 points' because its he/she has chosen all 3 answers
<html> <body> <?php $score1=0; $ques1 = $_POST['ques1']; $x=count($ques1); if($x!=3) {echo "1. You can only/have to check 3 boxes.   ";} else { foreach($ques1 as $x) {echo"$x";} if($x=="A" && $x=="C" && $x=="E") { $score1=$score1+5; } if ($x=="B" OR $x=="D") {echo "  1. Wrong    "; $score1=$score1-5;} } echo"  1. You have $score1 points.<br><br>"; ?> </body> </html>
if($x=="A" && $x=="C" && $x=="E") is a real fussy line of code. Your logic, although I don't know PHP, looks OK. I would guess that you're having a problem related to character encoding, say UTF-16 with an ASCII comparison.
Join our real-time social learning platform and learn together with your friends!