Ask your own question, for FREE!
Computer Science 8 Online
OpenStudy (anonymous):

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

OpenStudy (anonymous):

<html> <body> <?php $score1=0; $ques1 = $_POST['ques1']; $x=count($ques1); if($x!=3) {echo "1. You can only/have to check 3 boxes.&nbsp &nbsp";} else { foreach($ques1 as $x) {echo"$x";} if($x=="A" && $x=="C" && $x=="E") { $score1=$score1+5; } if ($x=="B" OR $x=="D") {echo "&nbsp 1. Wrong &nbsp &nbsp"; $score1=$score1-5;} } echo"&nbsp 1. You have $score1 points.<br><br>"; ?> </body> </html>

OpenStudy (rsmith6559):

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.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!